Skip to content

Commit 9069d11

Browse files
HunteRoiTinaël Devresse
authored andcommitted
fix: fix config for SMTP & adapt mail content
1 parent 0c17989 commit 9069d11

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

config.development.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@
146146
"communicationServiceOptions": {
147147
"from": "noreply-discord@henallux.be",
148148
"port": 587,
149-
"host": "smtp.office365.com"
149+
"host": "smtp.office365.com",
150+
"tls": {
151+
"rejectUnauthorized": false
152+
},
153+
"debug": true,
154+
"logger": true
150155
}
151156
}

config.production.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@
154154
"communicationServiceOptions": {
155155
"from": "noreply-discord@henallux.be",
156156
"port": 587,
157-
"host": "smtp.office365.com"
157+
"host": "smtp.office365.com",
158+
"tls": {
159+
"rejectUnauthorized": false
160+
}
158161
}
159162
}

src/config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ export async function readConfig(): Promise<Configuration> {
5353
...json,
5454
version: `${environment}-v${packageInfo.version}`,
5555
};
56-
config.communicationServiceOptions.auth.user = process.env.SMTP_USER;
57-
config.communicationServiceOptions.auth.pass = process.env.SMTP_PASS;
56+
config.communicationServiceOptions.auth = {
57+
user: process.env.SMTP_USER,
58+
pass: process.env.SMTP_PASS
59+
};
5860

5961
return config;
6062
} catch (err: unknown) {

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)