Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Delivered-To header the right place to find the address of the recipient for forwarded mail?

Tags:

email

header

There is a mail processing script on example.com that processes emails sent to addresses like: [email protected]

The mail server has a catch-all for example.com and processes the email into the appropriate account.

For users who have setup up a forwarding rule from another email address I'm having trouble finding the right header to check for the account. For example if the user with account1234 has a gmail rule that forwards certain emails sent to [email protected] to [email protected] then the processing script will find [email protected] in the To: header and [email protected] in the Delivered-To: header.

Is that Delivered-To: header guaranteed to be there or is this specific to the mail server doing the forwarding?

like image 583
Empty Hammer Avatar asked Jan 20 '11 01:01

Empty Hammer


1 Answers

Unfortunately, it's specific to the host doing the forwarding. And it's not even there for your benefit -- it's there to allow the forwarding server to detect and break mail loops. (For instance, [email protected] forwards to [email protected], which forwards back to [email protected].) Various servers use different header fields for this purpose, and there is no formal standard.

like image 119
dkarp Avatar answered Nov 16 '22 04:11

dkarp