-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from SocialGouv/feat/mailer-to-nodemailer
feat: change aws email to nodemailer
- Loading branch information
Showing
9 changed files
with
108 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var nodemailer = require('nodemailer'); | ||
|
||
export async function sendMail( | ||
subject: string, | ||
toEmail: string, | ||
html: string, | ||
text: string | ||
) { | ||
var transporter = nodemailer.createTransport({ | ||
host: process.env.NODEMAILER_HOST, | ||
port: process.env.NODEMAILER_PORT, | ||
auth: { | ||
user: process.env.NODEMAILER_USER, | ||
pass: process.env.NODEMAILER_PASSWORD | ||
} | ||
}); | ||
|
||
var mailOptions = { | ||
from: process.env.NODEMAILER_FROM, | ||
to: toEmail, | ||
subject: subject, | ||
html, | ||
text | ||
}; | ||
|
||
transporter.sendMail(mailOptions, function (error: any) { | ||
if (error) { | ||
throw new Error(error); | ||
} else { | ||
return true; | ||
} | ||
}); | ||
} |
Oops, something went wrong.