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}`
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.')
}
? 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) {