Skip to content

Commit

Permalink
Merge pull request #41 from Inist-CNRS/feat/mail
Browse files Browse the repository at this point in the history
Add a way to configure mail from
  • Loading branch information
AlasDiablo authored May 16, 2024
2 parents dfb1bec + af16727 commit 00dc126
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions tdm-be/config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"isHttps": false
}
},
"mailFrom": "\"ISTEX IA Factory\" <dev@local>" ,
"smtp": {
"host": "tdm-factory-dev-maildev",
"port": 1025,
Expand Down
1 change: 1 addition & 0 deletions tdm-be/config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"isHttps": false
}
},
"mailFrom": "\"ISTEX IA Factory\" <no-reply@ia-factory.services.istex.fr>" ,
"smtp": {
"host": "{mail services host}",
"port": 1025,
Expand Down
1 change: 1 addition & 0 deletions tdm-be/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Config = {
internal: Host;
external: Host;
};
mailFrom?: string;
smtp: SMTP;
cron: {
schedule: string;
Expand Down
6 changes: 3 additions & 3 deletions tdm-be/src/lib/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 00dc126

Please sign in to comment.