-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmtp.js
43 lines (38 loc) · 1.85 KB
/
smtp.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
//Nodemailer NPM package used to send emails
const nodemailer = require("nodemailer");
//Create reusable transporter object using the default SMTP transport
const emailTransporter = nodemailer.createTransport({
host: process.env.EMAIL_HOSTNAME,
port: process.env.EMAIL_PORT,
secure: true, //true for 465, false for other ports
auth: {
user: process.env.EMAIL_USERNAME,
pass: process.env.EMAIL_PASSWORD
}
});
//Output connection status to server console
emailTransporter.verify((err, success) => {
if (err) console.error(err);
if (success) console.log('Your nodemailer config is working');
});
//Create Default registration email
const registrationEmail = {
from: '"Bitcoin Maximalism" <[email protected]>', //sender address
to: "[email protected], [email protected]", //list of receivers
subject: "Confirm Your Email for BitcoinMaximalism.com", //Subject line
text: "Thanks for registering for BitcoinMaximalism.com!! Please confirm your email address by navigating to: ", //plain text body
html: 'Thanks for registering for <a href="www.BitcoinMaximalism.com">BitcoinMaximalism.com</a>!! Please confirm your email address by navigating to: ' //html body
};
//Default Password Reset
const passwordResetEmail = {
from: '"Bitcoin Maximalism" <[email protected]>', //sender address
to: "[email protected], [email protected]", //list of receivers
subject: "Password Reset for BitcoinMaximalism.com", //Subject line
text: "Someone has requested a password reset for BitcoinMaximalism.com!! Please continue by navigating to: ", //plain text body
html: 'Someone has requested a password reset for <a href="www.BitcoinMaximalism.com">BitcoinMaximalism.com</a>!! Please continue by navigating to: ' //html body
};
module.exports = {
emailTransporter,
registrationEmail,
passwordResetEmail
};