fix: Allow for offline development

This commit is contained in:
Tom Moor
2021-06-21 21:40:28 -07:00
parent ede7f2e3e6
commit 3cec6b4903

View File

@ -197,19 +197,24 @@ export class Mailer {
if (useTestEmailService) {
log("SMTP_USERNAME not provided, generating test account…");
let testAccount = await nodemailer.createTestAccount();
const smtpConfig = {
host: "smtp.ethereal.email",
port: 587,
secure: false,
auth: {
user: testAccount.user,
pass: testAccount.pass,
},
};
try {
let testAccount = await nodemailer.createTestAccount();
this.transporter = nodemailer.createTransport(smtpConfig);
const smtpConfig = {
host: "smtp.ethereal.email",
port: 587,
secure: false,
auth: {
user: testAccount.user,
pass: testAccount.pass,
},
};
this.transporter = nodemailer.createTransport(smtpConfig);
} catch (err) {
log(`Could not generate test account: ${err.message}`);
}
}
}
}