Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit bf93f6f

Browse files
committed
mails via gmail
1 parent e51a168 commit bf93f6f

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

dist/services/MailService.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ const path_1 = __importDefault(require("path"));
1010
class MailService {
1111
constructor() {
1212
this.transporter = nodemailer_1.default.createTransport({
13-
host: process.env.SMTP_HOST || 'mail.croissant-api.fr',
14-
port: Number(process.env.SMTP_PORT) || 587,
15-
secure: false, // true for 465, false for other ports
13+
service: "gmail",
1614
auth: {
17-
user: process.env.SMTP_USER || 'noreply@croissant-api.fr',
15+
user: process.env.SMTP_USER,
1816
pass: process.env.SMTP_PASS,
1917
},
2018
});
@@ -23,7 +21,7 @@ class MailService {
2321
const templatePath = path_1.default.join(process.cwd(), 'mailTemplates', template);
2422
const html = await ejs_1.default.renderFile(templatePath, data || {});
2523
const mailOptions = {
26-
from: process.env.SMTP_FROM || 'Croissant API <noreply@croissant-api.fr>',
24+
from: process.env.SMTP_FROM || 'Croissant API <support@croissant-api.fr>',
2725
to,
2826
subject,
2927
html,

src/services/MailService.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@ export class MailService implements IMailService {
1212

1313
constructor() {
1414
this.transporter = nodemailer.createTransport({
15-
host: process.env.SMTP_HOST || 'mail.croissant-api.fr',
16-
port: Number(process.env.SMTP_PORT) || 587,
17-
secure: false, // true for 465, false for other ports
15+
service: "gmail",
1816
auth: {
19-
user: process.env.SMTP_USER || 'noreply@croissant-api.fr',
17+
user: process.env.SMTP_USER,
2018
pass: process.env.SMTP_PASS,
2119
},
2220
});
21+
2322
}
2423

2524
private async sendTemplateMail(to: string, template: string, subject: string, data?: Record<string, unknown>) {
2625
const templatePath = path.join(process.cwd(), 'mailTemplates', template);
2726
const html = await ejs.renderFile(templatePath, data || {});
2827
const mailOptions = {
29-
from: process.env.SMTP_FROM || 'Croissant API <noreply@croissant-api.fr>',
28+
from: process.env.SMTP_FROM || 'Croissant API <support@croissant-api.fr>',
3029
to,
3130
subject,
3231
html,

0 commit comments

Comments
 (0)