Skip to content

Support optional SMTP\_HELO\_HOST to separate EHLO identity from WEB\_HOST #366

@S4r4h-O

Description

@S4r4h-O

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:

    1. Serve the UI on mail.example.com while advertising EHLO as example.com (by setting SMTP_HELO_HOST=example.com)
    2. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions