diff --git a/tdm-be/config/development.json b/tdm-be/config/development.json index e90441a..0e05668 100644 --- a/tdm-be/config/development.json +++ b/tdm-be/config/development.json @@ -9,6 +9,7 @@ "isHttps": false } }, + "mailFrom": "\"ISTEX IA Factory\" " , "smtp": { "host": "tdm-factory-dev-maildev", "port": 1025, diff --git a/tdm-be/config/production.json b/tdm-be/config/production.json index 1078240..927ba01 100644 --- a/tdm-be/config/production.json +++ b/tdm-be/config/production.json @@ -10,6 +10,7 @@ "isHttps": false } }, + "mailFrom": "\"ISTEX IA Factory\" " , "smtp": { "host": "{mail services host}", "port": 1025, diff --git a/tdm-be/src/lib/config.ts b/tdm-be/src/lib/config.ts index 01c7ba0..2113ca8 100644 --- a/tdm-be/src/lib/config.ts +++ b/tdm-be/src/lib/config.ts @@ -26,6 +26,7 @@ type Config = { internal: Host; external: Host; }; + mailFrom?: string; smtp: SMTP; cron: { schedule: string; diff --git a/tdm-be/src/lib/email.ts b/tdm-be/src/lib/email.ts index cffd488..606b6b2 100644 --- a/tdm-be/src/lib/email.ts +++ b/tdm-be/src/lib/email.ts @@ -43,7 +43,7 @@ export const sendStartedMail = async (options: StartedMailOptions) => { const text = nunjucks.render('processing-started.njk', options.data); await transporter.sendMail({ - from: 'no-reply@inist.fr', + from: environment.mailFrom ?? 'dev@local', to: options.email, subject: `IA Factory - Notification de creation - Traitement ${options.data.processingId}`, text, @@ -66,7 +66,7 @@ export const sendFinishedMail = async (options: FinishedMailOptions) => { const text = nunjucks.render('processing-finished.njk', options.data); await transporter.sendMail({ - from: 'no-reply@inist.fr', + from: environment.mailFrom ?? 'dev@local', to: options.email, subject: `IA Factory - Résultat - Traitement ${options.data.processingId}`, text, @@ -89,7 +89,7 @@ export const sendErrorMail = async (options: ErrorMailOptions) => { const text = nunjucks.render('processing-error.njk', options.data); await transporter.sendMail({ - from: 'no-reply@inist.fr', + from: environment.mailFrom ?? 'dev@local', to: options.email, subject: `IA Factory - Rapport d'erreur - Traitement ${options.data.processingId}`, text,