allow optional transport params

This commit is contained in:
Alex Holliday committed 2025-05-16 15:02:07 -07:00
1 parent d71181e65b
commit f6a2a66386
1 file changed
+10 -2
+10 -2
View File
@@ -89,8 +89,16 @@ class EmailService {
* @param {string} subject - The subject of the email.
* @returns {Promise<string>} A promise that resolves to the messageId of the sent email.
*/
buildAndSendEmail = async (template, context, to, subject) => {
buildAndSendEmail = async (template, context, to, subject, transportConfig) => {
// TODO - Consider an update transporter method so this only needs to be recreated when smtp settings change
let config;
if (typeof transportConfig !== "undefined") {
config = transportConfig;
} else {
config = this.settingsService.getDBSettings();
}
const {
systemEmailHost,
systemEmailPort,
@@ -98,7 +106,7 @@ class EmailService {
systemEmailAddress,
systemEmailPassword,
systemEmailConnectionHost,
} = await this.settingsService.getDBSettings();
} = config;
const baseEmailConfig = {
host: systemEmailHost,