This change makes the external command code return a generic 554 error to the SMTP client if the external command fails, so it knows sending failed and can retry.
This has several benefits:
- Configuration errors are caught at startup rather than upon a connection
- mailHandler() has less work to do for each connection
Rather than relying on remote_user and remote_pass to control whether
authentication is used, introduce an explicit "none" type for
remote_auth, and make that the default. (This is effectively the same
default behavior since remote_user and remote_pass default to empty.)
Also, we are in a better position to more thoroughly check for
configuration errors or mismatches:
- If remote_auth is given, remote_user and remote_pass are required.
- If remote_auth is given, remote_host is also required (because it
makes no sense to say we're going to authenticate if we have no server
to which to authenticate.)
- If remote_user or remote_pass are given, remote_auth cannot be "none".
This has several benefits:
- Configuration errors are caught at startup rather than upon a connection
- recipientChecker() has less work to do for each connection
This has several benefits:
- Configuration errors are caught at startup rather than upon a connection
- senderChecker() has less work to do for each connection
This has several benefits:
- Configuration errors are caught at startup rather than upon a connection
- connectionChecker() has less work to do for each connection
peerIP = net.ParseIP(addr.IP.String())
can be simplified to just:
peerIP = addr.IP
but we can also skip the safe cast since we know the net.Addr will always
be net.TCPAddr because we only have TCP listeners.
* Expand allowedUsers email field to support comma-separated and domains
Closes#8
* Refactor AuthFetch() to return AuthUser struct
Also, this breaks out a parseLine() function which can be easily tested.
* Ignore empty addrs after splitting commas
This ignores a trailing comma
* Add tests for auth parseLine()
* Update documentation in smtprelay.ini
* Fix bug where addrAllowed() was incorrectly case-sensitive
* Update allowedUsers allowed domain format to require leading @
This disambiguates a local user ('john.smith') from a domain ('example.com')