Skip to content

Commit d09d5ee

Browse files
author
HunteRoi
committed
fix: fix config for SMTP & adapt mail content
1 parent 7dd871f commit d09d5ee

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

config.development.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@
148148
"communicationServiceOptions": {
149149
"from": "[email protected]",
150150
"port": 587,
151-
"host": "smtp.office365.com"
151+
"host": "smtp.office365.com",
152+
"tls": {
153+
"rejectUnauthorized": false
154+
},
155+
"debug": true,
156+
"logger": true
152157
}
153158
}

config.production.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@
156156
"communicationServiceOptions": {
157157
"from": "[email protected]",
158158
"port": 587,
159-
"host": "smtp.office365.com"
159+
"host": "smtp.office365.com",
160+
"tls": {
161+
"rejectUnauthorized": false
162+
}
160163
}
161164
}

src/config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ export async function readConfig(): Promise<Configuration> {
5050
}
5151

5252
const config = { ...json, version: `${environment}-v${packageInfo.version}` };
53-
config.communicationServiceOptions.auth.user = process.env.SMTP_USER;
54-
config.communicationServiceOptions.auth.pass = process.env.SMTP_PASS;
53+
config.communicationServiceOptions.auth = {
54+
user: process.env.SMTP_USER,
55+
pass: process.env.SMTP_PASS
56+
};
5557

5658
return config;
5759
}

src/services/SMTPService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { ISenderAPI, SenderAPIData } from '@hunteroi/discord-verification';
12
import { createTransport } from 'nodemailer';
23
import SMTPTransport from 'nodemailer/lib/smtp-transport';
3-
import { ISenderAPI, SenderAPIData } from '@hunteroi/discord-verification';
44

55
export type SMTPServiceOptions = SMTPTransport.Options;
66

@@ -17,9 +17,9 @@ export default class SMTPService implements ISenderAPI {
1717
await transporter.sendMail({
1818
from: this.#options.from,
1919
to: data.to,
20-
subject: 'Discord Authentication Code',
21-
text: `Hello ${name}! Your code is ${code}. See you soon o/`,
22-
html: `<p>Hello ${name}!</p><p>Your code is ${code}.</p><p>See you soon o/</p>`
20+
subject: "Code d'Authentification Discord",
21+
text: `Hello ${name}! Ton code est ${code}. A plus tard o/`,
22+
html: `<p>Hello ${name}!</p><p>Ton code est ${code}.</p><p>A plus tard o/</p>`
2323
});
2424
}
2525
}

0 commit comments

Comments
 (0)