refactor: make SMTP configuration configurable via environment variables
This commit is contained in:
8
index.js
8
index.js
@@ -443,15 +443,15 @@ app.get('/location/:id', async (req, res) => {
|
||||
|
||||
// Configure nodemailer with your own server
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'mail.uplink.tel', // Replace with your SMTP server
|
||||
port: 465, // Replace with your SMTP port (587 is common for TLS)
|
||||
secure: true, // Set to true if using port 465
|
||||
host: process.env.SMTP_HOST || 'mail.uplink.tel',
|
||||
port: parseInt(process.env.SMTP_PORT, 10) || 465,
|
||||
secure: (process.env.SMTP_SECURE || 'true').toLowerCase() === 'true',
|
||||
auth: {
|
||||
user: process.env.ADMIN_EMAIL, // Admin email
|
||||
pass: process.env.EMAIL_PASSWORD // Email password
|
||||
},
|
||||
tls: {
|
||||
rejectUnauthorized: false // Use this if you encounter certificate issues
|
||||
rejectUnauthorized: (process.env.SMTP_TLS_REJECT_UNAUTHORIZED || 'false').toLowerCase() === 'true' // Default to false for rejectUnauthorized
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user