feat: make inbound SMTP greeting/EHLO hostname configurable#9
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7
Problem
The inbound SMTP listener hardcoded
localhostin both the220connection greeting and the250-EHLO reply, regardless of deployment.server.helo_hostnameonly controls the outbound EHLO name (passed to lettre), so there was no way to configure the inbound identity.Changes
server.hostnameconfig field — the identity announced in the inbound220greeting and EHLO reply.helo_hostnameremains 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).hostnamecrate, already in the dependency tree through lettre'shostnamefeature), withlocalhostas a last resort if the lookup fails.SmtpServerin thesmtpcrate gains awith_hostname()builder; the library default stayslocalhost, keeping the crate free of config/OS-lookup concerns. Resolution happens insmtp-server/src/main.rs, and the resolved name is logged at startup.config.example.toml,config.example.huml, and the docs (configuration page + reference examples).Verification
cargo test --workspace: 153 passed, 0 failed.hostname = "mx.verify.test":