Skip to content

Commit

Permalink
fix: mailer dynamic auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Sep 14, 2023
1 parent 01fba0e commit 3083913
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions webapp-next/utils/mailter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ export async function sendMail(
html: string,
text: string
) {
var transporter = nodemailer.createTransport({
var transportOptions: any = {
host: process.env.NODEMAILER_HOST,
port: process.env.NODEMAILER_PORT,
auth: {
secure: true
};

if (process.env.NODEMAILER_USER && process.env.NODEMAILER_PASSWORD) {
transportOptions.auth = {
user: process.env.NODEMAILER_USER,
pass: process.env.NODEMAILER_PASSWORD
}
});
};
}

var transporter = nodemailer.createTransport(transportOptions);

var mailOptions = {
from: process.env.NODEMAILER_FROM,
Expand Down

0 comments on commit 3083913

Please sign in to comment.