drupal_mail() sets the Reply-To header to the same value as From. This is redundant and causes some mail clients to display two identical addresses (see screenshot).
According to RFC 2822, section 3.6.2, the Reply-To header is optional. When replying to a message without a Reply-To header, the messages should be sent to the address in the From header, i.e. removing the identical Reply-To header will not make replies go somewhere else.
The originator fields of a message consist of the from field, the sender field (when applicable), and optionally the reply-to field.
[...]
When the "Reply-To:" field is present, it indicates the mailbox(es) to which the author of the message suggests that replies be sent. In the absence of the "Reply-To:" field, replies SHOULD by default be sent to the mailbox(es) specified in the "From:" field unless otherwise specified by the person composing the reply.
I don't think that removing the Reply-To header will cause any compatibility problems. Regular mail clients do not add Reply-To headers unless explicitly configured to do so.
This patch makes drupal_mail() not set Reply-To. Modules may still use $message['headers']['Reply-To'] = 'somebody@example.org' if they wish to set Reply-To. Note that there was an error in the documentation of the $from argument. Setting From does not affect Error-To - with our without the patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | reply-to-d5-1.patch | 2.58 KB | c960657 |
| #4 | reply-to-d6-1.patch | 2.46 KB | c960657 |
| Reply-To.png | 17.36 KB | c960657 | |
| reply-to-1.patch | 2.45 KB | c960657 |
Comments
Comment #1
cburschkaTested, works great. I've run contact and user registration simple tests with no adverse effects, too.
Comment #2
moshe weitzman commentedlooks good.
Comment #3
dries commentedCommitted to CVS HEAD. Thanks!
The patch doesn't apply against Drupal 6 so I've update the status accordingly.
Comment #4
c960657 commentedRerolled for D5 and D6.
Comment #5
cburschkaApplies in 6.x, and removes the reply-to.
I don't have a D5 testing environment right now...
Comment #6
aries commentedPatch works for me, I'd like like to see this feature in the core too.
Comment #7
cburschkaTwo reviews are enough for RTBC, I believe. That refers to the D6 patch.
Still needs review for D5.
Comment #8
gábor hojtsyTried to dig up the reason for setting reply-to the same. I vaguely remembered that it would be for mailserver compatibility reasons (ie. crippled mailservers). I did not manage to dig up any supporting data from the internet. I also digged into our code history and found the reply-to duplication at least back to Drupal 4.0. Since there is not much code history there (I did not find the place where it was introduced, since it was in the 1.1 version of the user.module almost 8 years ago: http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/user.module?annota...). Finally I looked into the PHP docs on mail() and did not find any compelling reasons on why we should stick to our same-reply-to policy.
Committed to Drupal 6! Needs review on 5.x.
Comment #9
drummCommitted to 5.x.