Created
August 5, 2020 15:56
-
-
Save abhisheksimion/0d783296729a0967a0b66293c20886f5 to your computer and use it in GitHub Desktop.
A custom action that utilizes nodemailer to send mails.
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
const nodemailer = require('nodemailer'); | |
async function main() { | |
let testAccount = await nodemailer.createTestAccount(); | |
let transporter = nodemailer.createTransport({ | |
host: 'smtp.ethereal.email', | |
port: 587, | |
secure: false, // true for 465, false for other ports | |
auth: { | |
user: testAccount.user, // generated ethereal user | |
pass: testAccount.pass, // generated ethereal password | |
} | |
}); | |
let usermessage = "This is email body example"; | |
// Create a message object | |
let message = { | |
from: 'Freeman <freeman24@ethereal.email>', | |
to: 'abhisheksimon@aabingunz.com, mbrown@gmail.com', | |
subject: 'This is your email Subject', | |
text: 'This is your email body Message: \t'+usermessage}; | |
// Sending message | |
transporter.sendMail(message); | |
} | |
main().catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment