-
Notifications
You must be signed in to change notification settings - Fork 174
Open
Labels
Description
Many self-hosted setups serve the web UI on a subdomain (for example, mail.example.com) while sending mail as the root domain (example.com). Today, adjusting that behavior requires a manual code change because the server always uses WEB_HOST (or DOMAIN) for both the UI and SMTP HELO/EHLO.
Suggested Approach
We could introduce a new environment variable, SMTP_HELO_HOST. When set, the server would use it for the HELO/EHLO hostname; otherwise it would fall back to the existing WEB_HOST or DOMAIN.
Details
-
Code change in smtp-server.js
Update the instantiation of SMTPServer so that the name option checks SMTP_HELO_HOST first:this.server = new SMTPServer({ - name: process.env.WEB_HOST || process.env.DOMAIN, + name: process.env.SMTP_HELO_HOST || process.env.WEB_HOST || process.env.DOMAIN, // other options… });
-
Defaults and documentation
In .env.defaults, document the new variable:# Optional HELO/EHLO hostname. Falls back to WEB_HOST or DOMAIN if unset. SMTP_HELO_HOST=
Add a section to README.md explaining how to:
- Serve the UI on mail.example.com while advertising EHLO as example.com (by setting SMTP_HELO_HOST=example.com)
- Continue default behavior for single-host setups by leaving it blank
Benefits
- Avoids manual patches for common self-hosted patterns
- Keeps existing behavior unchanged for users who don’t set the new variable
- Improves clarity in configuration and documentation