Closed rimas-kudelis closed 6 months ago
Do you know how such mails are handled in general? RFC just says the sender server either forwards the mail to the new address or returns an error message to the sender (https://tools.ietf.org/html/rfc821#page-7).
I believe in most cases the rejection is just reported as usual, with the original message quoted. Here's what Gmail does, for example:
If you click on the three dots at the bottom, you can see the original email quoted.
The SMTP standard has specified a separate response code which may be used when an email address to which a message is attempted to be delivered has changed and a different address should be used. That code is 551, and a suggested message is "User not local; please try <forward-path>".
Sadly, the standard does not specify what exactly the sender should do upon receiving this error code. Instead, it says the server [...] MUST NOT assume that the client will actually update address information or even return that information to the user[.] upon receiving that error code.
However, I propose that we add means to manage such addresses and properly report them to the sending servers.
Rationale
Some reasons why I want to use this functionality (and why I think it may be useful to others) are listed in this StackOverflow thread from 2015. With the "transparent" forwards that we have now:
But that's not all. I think a couple more points may be added to this list nowadays:
Implementation details
I see two ways how we could do this:
type
(in addition to the currently definedlocal
,alias
,catch
,fail
,piped
,admin
andsite
types). This would require:fail
type: allow to optionally specify a "new" email address and if it is specified, fail with code 551 and that email address. We could reuse theforward
database field for the address, so this would only require:Option 1. seems perhaps a bit cleaner, but option 2. looks good as well, considering that 551 should most likely be seen as a fail code at the moment, and it will probably stay that way. Edit: actually, I think I'm in favor of option 2.