diff --git a/.env.example b/.env.example index 6555d26..bb3ff33 100644 --- a/.env.example +++ b/.env.example @@ -39,7 +39,6 @@ DEFAULT_ASSIGNEE_EMAIL=you@yourdomain.com ADMIN_EMAIL=you@yourdomain.com # Outbound mail transport: 'mailgun' or 'smtp' (default: mailgun) -# In development, MailHog is always used regardless of this setting. MAIL_TRANSPORT=smtp # SMTP relay — used when MAIL_TRANSPORT=smtp @@ -55,11 +54,6 @@ SMTP_RELAY_PASS= MAILGUN_API_KEY= MAILGUN_DOMAIN= -# MailHog - used automatically in development (NODE_ENV != production) -# Host should match the docker-compose service name -MAILHOG_HOST=mailhog -MAILHOG_PORT=1025 - # Data directory inside the container (leave as-is for Docker) DATA_DIR=/app/data UPLOADS_DIR=/app/data/uploads diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 61c30e0..f31e9ee 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -17,4 +17,3 @@ services: - NODE_ENV=production restart: unless-stopped command: node src/app.js - # No mailhog dependency in production diff --git a/docker-compose.yml b/docker-compose.yml index 6bbfb68..a46b8f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,13 +16,4 @@ services: environment: - NODE_ENV=development restart: unless-stopped - depends_on: - - mailhog command: npx nodemon src/app.js - - mailhog: - image: mailhog/mailhog:latest - ports: - - "1025:1025" # SMTP - - "8025:8025" # Web UI - view captured emails at http://localhost:8025 - restart: unless-stopped diff --git a/src/config.js b/src/config.js index 14a5996..5848602 100644 --- a/src/config.js +++ b/src/config.js @@ -52,10 +52,6 @@ const config = { pass: process.env.SMTP_RELAY_PASS || '', }, - mailhog: { - host: process.env.MAILHOG_HOST || 'mailhog', - port: parseInt(process.env.MAILHOG_PORT || '1025', 10), - }, }; module.exports = config; diff --git a/src/services/mail.js b/src/services/mail.js index 7220ae0..95473b7 100644 --- a/src/services/mail.js +++ b/src/services/mail.js @@ -9,15 +9,7 @@ let _transport = null; function getTransport() { if (_transport) return _transport; - if (config.isDev) { - // MailHog — catches all outbound mail in a local web UI - _transport = nodemailer.createTransport({ - host: config.mailhog.host, - port: config.mailhog.port, - secure: false, - ignoreTLS: true, - }); - } else if (config.mailTransport === 'smtp') { + if (config.mailTransport === 'smtp') { // SMTP relay (e.g. Google Workspace smtp-relay.gmail.com) // port 587 → STARTTLS, port 465 → implicit TLS _transport = nodemailer.createTransport({ @@ -66,11 +58,11 @@ async function send({ to, subject, html, text, messageId, inReplyTo, references, const from = `Ticketing <${config.ticketEmail}>`; const transport = getTransport(); - if (!config.isDev && config.mailTransport === 'mailgun') { + if (config.mailTransport === 'mailgun') { // Mailgun REST wrapper expects flat options; headers are passed as h:* keys await transport.sendMail({ from, to, subject, html, text, messageId, inReplyTo, references, replyTo }); } else { - // nodemailer (MailHog in dev, SMTP relay in prod) + // nodemailer SMTP relay await transport.sendMail({ from, to, subject, html, text, messageId,