X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Femailer.ts;h=7484524a4542880e016e43d149a3ac0e830a5524;hb=32c68d67d9125df62ead71668efca4da30132786;hp=bd3d4f252eb120132bb01dd27cd5cb1655c7b59e;hpb=8c559fad1e1c4c2ab7f1388c73200aa4c6256d74;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index bd3d4f252..7484524a4 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -369,7 +369,7 @@ class Emailer { addPasswordResetEmailJob (to: string, resetPasswordUrl: string) { const text = `Hi dear user,\n\n` + `A reset password procedure for your account ${to} has been requested on ${WEBSERVER.HOST} ` + - `Please follow this link to reset it: ${resetPasswordUrl}\n\n` + + `Please follow this link to reset it: ${resetPasswordUrl} (the link will expire within 1 hour)\n\n` + `If you are not the person who initiated this request, please ignore this email.\n\n` + `Cheers,\n` + `${CONFIG.EMAIL.BODY.SIGNATURE}` @@ -441,7 +441,7 @@ class Emailer { return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) } - sendMail (options: EmailPayload) { + async sendMail (options: EmailPayload) { if (!Emailer.isEnabled()) { throw new Error('Cannot send mail because SMTP is not configured.') } @@ -450,13 +450,15 @@ class Emailer { ? options.fromDisplayName : WEBSERVER.HOST - return this.transporter.sendMail({ - from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`, - replyTo: options.replyTo, - to: options.to.join(','), - subject: options.subject, - text: options.text - }) + for (const to of options.to) { + await this.transporter.sendMail({ + from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`, + replyTo: options.replyTo, + to, + subject: options.subject, + text: options.text + }) + } } private dieOnConnectionFailure (err?: Error) {