-
Notifications
You must be signed in to change notification settings - Fork 0
/
foolishEmail.js
40 lines (33 loc) · 1.1 KB
/
foolishEmail.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var nodemailer = require('nodemailer');
// create reusable transporter object using SMTP transport
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'bestPasswordEVER'
}
});
var meatballCount = 25;
var otherVar = 'This is my other var';
//THIS IS HORRIBLY PAINFUL AND DISGUSTING AND TOTALLY UNMAINTAINABLE
var myHTML = '';
myHTML += '<h1 style="font-size: 15px; color:blue">Hello, This is a test</h1>';
if(meatballCount > 9000) {
myHTML += '<p style="font-size:25px; color:#880000">IT\'S OVER 9000!!!!!</p>';
} else {
myHTML += '<p style="color:deeppink">I have ' + meatballCount + ' meatballs</p>';
}
myHTML += '<p>' + otherVar + '</p>';
var emailInfo = {
from: 'Tester <[email protected]>', // sender address
to: 'INSERT AN EMAIL ADDRESS HERE, PREFERABLY YOUR OWN TO TEST WITH!', // comma delimited list of receivers
subject: '...an html email...',
html: myHTML
};
transporter.sendMail(emailInfo, function(error, info){
if(error){
console.log(error);
}else{
console.log('Message sent: ' + info.response);
}
});