Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 0 additions & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ services:
- NODE_ENV=production
restart: unless-stopped
command: node src/app.js
# No mailhog dependency in production
9 changes: 0 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
14 changes: 3 additions & 11 deletions src/services/mail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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,
Expand Down