This repository has been archived on 2024-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
email-test-nodejs/index.js

27 lines
623 B
JavaScript

var nodemailer = require('nodemailer');
var transport = nodemailer.createTransport({
host: 'mail.example.com',
port: 465,
secure: true,
auth: {
user: "user@example.com",
pass: "example-password"
}
});
var message = {
from: 'test@example.com',
to: '"Webmaster" <webmaster@example.com>',
subject: 'Nodemailer is unicode friendly ✔',
text: 'Hello to myself!',
};
transport.sendMail(message, function(error){
if(error){
console.log('Error occured');
console.log(error);
return;
}
transport.close();
});