-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserviceEmail.js
46 lines (41 loc) · 1009 Bytes
/
serviceEmail.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
46
const nodemailer = require("nodemailer");
/* login to https://ethereal.email/messages using
described credential to see all sent msgs.
*/
let transporter = () => {
return nodemailer.createTransport({
pool: true,
maxMessages: 100,
maxConnections: 5,
host: "smtp.ethereal.email",
port: 587,
secure: false, // use TLS
auth: {
user: "[email protected]",
pass: "XX7kqTF1xR71nnxPhG",
},
});
};
let newTransporter = transporter();
function sendMail(address_mail) {
const obj = {
from: '"Fred Foo 👻" <[email protected]>',
to: `${address_mail}`,
subject: `Payment✔`,
text: "Hello world?",
html: "<b>Lakukan pembayaran segera !</b>",
};
// return new Promise((resolve, reject) => {
// newTransporter.sendMail(obj, (err, info) => {
// if (err) {
// reject(err);
// } else {
// resolve(info);
// }
// });
// });
return newTransporter.sendMail(obj)
}
module.exports = {
sendMail,
};