Created
October 31, 2016 07:25
-
-
Save bilashcse/b7bf44dab54c31583265d42af36a1558 to your computer and use it in GitHub Desktop.
Send email through NodeJs script
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
var nodemailer = require('nodemailer'); | |
var transporter = nodemailer.createTransport(); | |
transporter.sendMail({ | |
from: 'sender@address', | |
to: 'receiver@address', | |
subject: 'hello', | |
text: 'hello world!' | |
}); | |
//Sending emails through SMTP is also possible (using Gmail, Hotmail, etc.): | |
var nodemailer = require('nodemailer'); | |
var transporter = nodemailer.createTransport({ | |
service: 'gmail', | |
auth: { | |
user: 'sender@gmail.com', | |
pass: 'password' | |
} | |
}); | |
transporter.sendMail({ | |
from: 'sender@address', | |
to: 'receiver@address', | |
subject: 'hello', | |
text: 'hello world!' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment