add sendSingleMail

This commit is contained in:
DATAEXPRESS\4734
2026-03-10 18:15:31 +08:00
parent 86e07c98e1
commit da72e6f958
+18
View File
@@ -46,6 +46,24 @@ class MailService {
} }
}); });
} }
/**
* 手動發送郵件方法 (供 API 呼叫)
*/
async sendSingleMail(mailto, mailtitle, mailtext) {
try {
await this.transporter.sendMail({
from: 'kylinsys@gmail.com',
to: mailto,
subject: mailtitle,
text: mailtext
});
return { success: true };
} catch (error) {
logger.error(`單筆郵件發送失敗: ${error.message}`);
return { success: false, error: error.message };
}
}
} }
module.exports = new MailService(); module.exports = new MailService();