allow optional transport params
This commit is contained in:
1 parent
d71181e65b
commit
f6a2a66386
1 file changed
+10
-2
@@ -89,8 +89,16 @@ class EmailService {
|
|||||||
* @param {string} subject - The subject of the email.
|
* @param {string} subject - The subject of the email.
|
||||||
* @returns {Promise<string>} A promise that resolves to the messageId of the sent 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
|
// 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 {
|
const {
|
||||||
systemEmailHost,
|
systemEmailHost,
|
||||||
systemEmailPort,
|
systemEmailPort,
|
||||||
@@ -98,7 +106,7 @@ class EmailService {
|
|||||||
systemEmailAddress,
|
systemEmailAddress,
|
||||||
systemEmailPassword,
|
systemEmailPassword,
|
||||||
systemEmailConnectionHost,
|
systemEmailConnectionHost,
|
||||||
} = await this.settingsService.getDBSettings();
|
} = config;
|
||||||
|
|
||||||
const baseEmailConfig = {
|
const baseEmailConfig = {
|
||||||
host: systemEmailHost,
|
host: systemEmailHost,
|
||||||
|
|||||||
Reference in new issue
Block a user