Skip to content

Commit abc896b

Browse files
author
gevic
committed
Nodemailer
1 parent a26e2bb commit abc896b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

nodeMailer.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Nodemailes is a module to send mails
2+
// Download using ```npm install nodemailer
3+
var mail = require('nodemailer');
4+
5+
// To send a simple mail
6+
// To send a mail you need some kind of transport
7+
var transport = mail.createTransport({
8+
service: 'gmail', // you mail service provider
9+
auth:{
10+
user: 'email@gmail.com',
11+
pass: 'secret'
12+
}
13+
});
14+
15+
// Now mail structure
16+
var mailStructure = {
17+
from: 'email@gmail.com',
18+
to: 'reciever@anything.com',
19+
subject: 'Checking Nodemailer',
20+
text: 'You got the meassage?'
21+
};
22+
23+
// Everything is ready, just send the mail
24+
transport.sendMail(function (err, info){
25+
if (err){
26+
console.log('error');
27+
} else {
28+
console.log('Email send: ' + info.response);
29+
}
30+
});

0 commit comments

Comments
 (0)