verify transport before sending email

This commit is contained in:
Alex Holliday committed 2025-06-25 09:35:41 +08:00
1 parent 915d2e06ae
commit 4cc3765e0d
3 files changed
+21 -5

No files matched your search

+11
View File
@@ -137,6 +137,17 @@ class EmailService {
};
this.transporter = this.nodemailer.createTransport(emailConfig);
try {
await this.transporter.verify();
} catch (error) {
this.logger.warn({
message: "Email transporter verification failed",
service: SERVICE_NAME,
method: "verifyTransporter",
});
return false;
}
try {
const info = await this.transporter.sendMail({
to: to,