-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (40 loc) · 1.13 KB
/
index.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
41
42
43
44
45
var nodemailer = require("nodemailer");
var aws = require("aws-sdk");
var ses = new aws.SES();
var optionalSubjects = [
[
"DON'T CUT YOUR FUCKING HAIR",
"JUST DON'T MATE, IT WILL LOOK GREAT WHEN IT'S GROWN OUT!!!"
],
[
"YOUR LONG HAIR WILL LOOK GREAT",
"EVEN AUTOSTRADDLE AGREES THAT ALTERNATIVE LIFESTYLE HAIRCUTS SUCK"
],
[
"I BELIEVE IN YOU HAVING LONG HAIR!",
"I KNOW IT'S HARD BUT I BELIEVE YOU WILL LOOK GREAT!"
],
["IMAGING IF THE GOYS HAD HAIR LIKE YOURS", "BITCHES BE JEWLOUS"]
];
function getRandomInt(max) {
return Math.round(Math.random() * Math.floor(max));
}
var seedArray = optionalSubjects[getRandomInt(optionalSubjects.length)];
exports.handler = function(event, context, callback) {
var mailOptions = {
from: process.env.EMAIL_FROM,
to: process.env.EMAIL_TO,
subject: seedArray[0],
text: seedArray[1]
};
var transporter = nodemailer.createTransport({ SES: ses });
transporter.sendMail(mailOptions, function(error, info) {
if (error) {
console.log(error);
callback(error);
} else {
console.log("Email sent:");
callback();
}
});
};