I'm currently coding from scratch a new SMTP server and I'm asking in which order "from" address counts?
If I receive an email with the following content:
Return-Path: foo1@bar.tld
...
From: Foo Bar <foo2@bar.tld>
and the email was received by the SMTP server with the command:
MAIL FROM: foo3@bar.tld
And my server wants now to answer on this email, on which address should it answer?
I guess the order would be first of the email header the "From:"
address, then "Return-Path:"
, and if all this would be missing, then the address of the "MAIL FROM"
command of the SMTP command?
Return-Path
is used for sending bounce messages (i.e. delivery status notifications), replies should be sent to Reply-to
if it exists, otherwise From
.
Note that when the mail is received with
MAIL FROM: <foo3@bar.tld>
the Return-Path
header should be updated to contain that address.