Skip to content

feat: make inbound SMTP greeting/EHLO hostname configurable#9

Merged
iamd3vil merged 1 commit into
mainfrom
feat/inbound-hostname
Jul 15, 2026
Merged

feat: make inbound SMTP greeting/EHLO hostname configurable#9
iamd3vil merged 1 commit into
mainfrom
feat/inbound-hostname

Conversation

@iamd3vil

@iamd3vil iamd3vil commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Fixes #7

Problem

The inbound SMTP listener hardcoded localhost in both the 220 connection greeting and the 250- EHLO reply, regardless of deployment. server.helo_hostname only controls the outbound EHLO name (passed to lettre), so there was no way to configure the inbound identity.

Changes

  • New optional server.hostname config field — the identity announced in the inbound 220 greeting and EHLO reply. helo_hostname remains outbound-only, since the two identities legitimately diverge (outbound name is tied to the sending IP's reverse DNS; inbound name is whatever the MX points to).
  • Default when unset: OS hostname (via the hostname crate, already in the dependency tree through lettre's hostname feature), with localhost as a last resort if the lookup fails.
  • SmtpServer in the smtp crate gains a with_hostname() builder; the library default stays localhost, keeping the crate free of config/OS-lookup concerns. Resolution happens in smtp-server/src/main.rs, and the resolved name is logged at startup.
  • Updated config.example.toml, config.example.huml, and the docs (configuration page + reference examples).

Verification

  • cargo test --workspace: 153 passed, 0 failed.
  • Live probe with hostname = "mx.verify.test":
    220 mx.verify.test ESMTP server ready
    250-mx.verify.test
    250-SIZE 26214400
    250 OK
    
  • Live probe with the field unset: banner shows the machine's OS hostname.

Add server.hostname to configure the identity announced in the 220
greeting and EHLO reply of the inbound listener. Defaults to the OS
hostname, falling back to localhost. helo_hostname remains outbound-only.

Fixes #7
@iamd3vil iamd3vil merged commit fe304b9 into main Jul 15, 2026
2 checks passed
@iamd3vil iamd3vil deleted the feat/inbound-hostname branch July 15, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inbound SMTP greeting and EHLO response hostname hardcoded to localhost

1 participant