-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail.js
45 lines (37 loc) · 1.35 KB
/
mail.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
const nodemailer = require('nodemailer');
const mailGun = require('nodemailer-mailgun-transport');
/*
const auth = {
auth: {
api_key: process.env.API_KEY || '5360e605f07b93e4e01da8e83cbcaf6c', // TODO: Replace with your mailgun API KEY
domain: process.env.DOMAIN || 'asessoriaessence.com.br' // TODO: Replace with your mailgun DOMAIN
}
};
*/
//const transporter = nodemailer.createTransport(mailGun(auth));
const transporter = nodemailer.createTransport({
host: "smtp.zoho.com",
port: 465,
//secure = true,
auth: {
user: "[email protected]",
pass: "@Site103020"
}
})
var x = "[email protected]"
const sendMail = (email, subject, text, empresa, name, cb) => {
const mailOptions = {
from: `${name} - Contato Através Site <[email protected]>`, // TODO replace this with your own email
to: "[email protected]", // TODO: the receiver email has to be authorized for the free tier
replyTo: email,
subject,
html: `Nome: ${name} <br> Empresa: ${empresa} <br> e-mail: ${email} <br> <br> ${text}`,
};
transporter.sendMail(mailOptions, function (err, data) {
if (err) {
return cb(err, null);
}
return cb(null, data);
});
}
module.exports = sendMail;