Fix email to field

This commit is contained in:
Chocobozzz 2019-11-29 13:36:40 +01:00
parent cb5ce4cb13
commit 47f6cb31d7
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 12 additions and 10 deletions

View File

@ -2,8 +2,8 @@
set -eu set -eu
if [ ! -f "./client/dist/en_US/index.html" ]; then if [ ! -f "./client/dist/en-US/index.html" ]; then
echo "client/dist/en_US/index.html does not exist, compile client files..." echo "client/dist/en-US/index.html does not exist, compile client files..."
npm run build:client -- --light npm run build:client -- --light
fi fi

View File

@ -441,7 +441,7 @@ class Emailer {
return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
} }
sendMail (options: EmailPayload) { async sendMail (options: EmailPayload) {
if (!Emailer.isEnabled()) { if (!Emailer.isEnabled()) {
throw new Error('Cannot send mail because SMTP is not configured.') throw new Error('Cannot send mail because SMTP is not configured.')
} }
@ -450,14 +450,16 @@ class Emailer {
? options.fromDisplayName ? options.fromDisplayName
: WEBSERVER.HOST : WEBSERVER.HOST
return this.transporter.sendMail({ for (const to of options.to) {
await this.transporter.sendMail({
from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`, from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`,
replyTo: options.replyTo, replyTo: options.replyTo,
to: options.to.join(','), to,
subject: options.subject, subject: options.subject,
text: options.text text: options.text
}) })
} }
}
private dieOnConnectionFailure (err?: Error) { private dieOnConnectionFailure (err?: Error) {
logger.error('Failed to connect to SMTP %s:%d.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT, { err }) logger.error('Failed to connect to SMTP %s:%d.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT, { err })