-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendEmail.js
39 lines (36 loc) · 1.03 KB
/
sendEmail.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
var nodemailer = require("nodemailer");
var smtpTransport = require("nodemailer-smtp-transport");
async function SendMail(mailOptions) {
return new Promise((resolve, reject) => {
var transporter = nodemailer.createTransport(
smtpTransport({
// service: "gmail",
// host: "smtp.gmail.com",
// auth: {
// user: "cudddan@gmail.com",
// pass: "blackmesa-123"
service: "localhost",
host: "mail.coinguru.biz",
port: 290,
secure: true,
auth: {
user: "support@coinguru.biz",
pass: "blackmesa-123"
},
tls: {
rejectUnauthorized: false
}
})
);
transporter.sendMail(mailOptions, function(error, info) {
if (error) {
console.log("error is " + error);
resolve(false); // or use rejcet(false) but then you will have to handle errors
} else {
console.log("Email sent: " + info.response);
resolve(true);
}
});
});
}
module.exports = { SendMail };