Skip to content

Instantly share code, notes, and snippets.

@abhisheksimion
Created August 5, 2020 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhisheksimion/0d783296729a0967a0b66293c20886f5 to your computer and use it in GitHub Desktop.
Save abhisheksimion/0d783296729a0967a0b66293c20886f5 to your computer and use it in GitHub Desktop.
A custom action that utilizes nodemailer to send mails.
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