diff --git a/docker-compose.yml b/docker-compose.yml index 2dc6648..085b47e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,10 @@ services: - EMAIL_PASSWORD=${EMAIL_PASSWORD} - DOMAIN=${DOMAIN} - ADMIN_PASSWORD=${ADMIN_PASSWORD} + - SMTP_HOST=${SMTP_HOST} + - SMTP_PORT=${SMTP_PORT} + - SMTP_SECURE=${SMTP_SECURE} + - SMTP_TLS_REJECT_UNAUTHORIZED=${SMTP_TLS_REJECT_UNAUTHORIZED} volumes: - .:/usr/src/app - ./data:/usr/src/app/data diff --git a/index.js b/index.js index 0bdfef5..6e285bb 100644 --- a/index.js +++ b/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 } });