Skip to content

Instantly share code, notes, and snippets.

@muhsalaa
Created September 23, 2020 13:53
Show Gist options
  • Save muhsalaa/5bc9bc9f00425f6311515bc46b9afdf1 to your computer and use it in GitHub Desktop.
Save muhsalaa/5bc9bc9f00425f6311515bc46b9afdf1 to your computer and use it in GitHub Desktop.
nodemailer setup, work for yandex and google
const nodemailer = require('nodemailer');
const smtpTransport = require('nodemailer-smtp-transport');
const transporter = nodemailer.createTransport(
smtpTransport({
service: 'yandex/google',
host: 'smtp.yandex.ru/smtp.gmail.com',
auth: {
user: '[email protected]',
pass: 'yourEmailPassword',
},
})
);
function sendEmail() {
const mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Hola como estas',
text: 'Berkabar ya',
};
transporter.sendMail(mailOptions, (err, info) => {
if (err) throw err;
console.log('Email sent: ' + info.response);
});
}
sendEmail();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment