26 lines
658 B
JavaScript
26 lines
658 B
JavaScript
const nodemailer = require('nodemailer');
|
|
|
|
const host = process.env.SMTP_HOST;
|
|
const port = 465; // Force 465
|
|
const secure = true; // Use TLS
|
|
const user = process.env.SMTP_USERNAME;
|
|
const pass = process.env.SMTP_PASSWORD;
|
|
const from = process.env.SMTP_FROM || 'test@example.com';
|
|
|
|
const transporter = nodemailer.createTransport({
|
|
host,
|
|
port,
|
|
secure,
|
|
auth: { user, pass },
|
|
tls: { rejectUnauthorized: false },
|
|
});
|
|
|
|
transporter.verify(function (error, success) {
|
|
if (error) {
|
|
console.log('SMTP Verification Error:', error);
|
|
} else {
|
|
console.log('SMTP Server is ready on port 465');
|
|
process.exit(0);
|
|
}
|
|
});
|