async-email / async-smtp

Apache License 2.0
60 stars 13 forks source link

Use address literal as default EHLO argument #30

Closed link2xt closed 4 years ago

link2xt commented 4 years ago

This commit fixes formatting of IPv4 and IPv6 address literals. Both are enclosed in brackets and IPv6 is prefixed with IPv6:.

Default trait is derived for ClientId.

Default ClientId is [127.0.0.1] now, because it passes the most strict Postfix smtpd_helo_restrictions checks.

Fallback domain ClientId is replaced with localhost.localdomain, because a domain must be an FQDN according to RFC 5321.

r10s commented 4 years ago

for understanding: is ClientId::hostname() that references DEFAULT_DOMAIN_CLIENT_ID (="localhost.localdomain") used anywhere?

link2xt commented 4 years ago

@r10s DC does not use it. It would be nice to remove this function and hostname dependency. If someone wants to use their machine hostname, they can use this or some other package directly and set their hostname with ClientId::new() and hello_name.

dignifiedquire commented 4 years ago

I would suggest making it a feature instead of removing it entirely

link2xt commented 4 years ago

@dignifiedquire This feature would only allow to use

.hello_name(ClientId::hostname())

instead of

.hello_name(ClientId::new(get_hostname().unwrap_or_else(|| "localhost.localdomain".to_string())))

I can only imagine it being used in some rust MTA, and it will probably want to determine its hostname once at startup, not every time it makes a connection to other system. And it probably wants to log the hostname it found during startup.

dignifiedquire commented 4 years ago

fair enough