Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#1593 closed defect (bug) (fixed)

Fixing the "From" address on all emails.

Reported by: Bernard_J_L Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords: email address from blocked bg|has-patch bg|commit bg|squashed
Focuses: Cc:


We keep having this small issue come up and manually fixing it. It might be others may have or soon might have a similar problem.

The core issue is some ISP's block generated mail messages if the "From" address is not within their domain. I suppose we can thank spammers for this.

Generally mail leaving Word Press very nicely uses the administrator email adddress as the "From" address and everything works as expected.

However, there is at least one place when someone makes a comment on an item, after it gets approved, Word Press sends a message to the originator of the item showing it coming from the creator of the comment.

Of couse the creator of the comment is generally the email address of the person who made the comment and is going to be off in some other domain which immediately gets blocked.

So we locate these and manually re-code to make the "From" address be the admin login and add a "Reply-to:" in the header to allow an easy reply to the creator of the comment.

To make it easy....could you please fix this in some future release to spare us this pain (finding the location in the code takes some time and I am not sure this is the only case this event occurs.).

Our suggestion would be ...

1) Use the RFC822 field "Sender" to always to be the Administrator email address as configured. (Currently Word Press does not set this field in any email headers.)
2) Set the RFC822 field "Reply-to" to what is the "from" field
3) Set the RFC822 field "From" the way you do right now.

I suppose if you want to do just the minimum you could add the "Sender" field with the administrator email to all messages and call it a day.

This would greatly easy our workload when we configure Word Press.

It would also perhaps be more elegant addressing since the "administrator" on the server is really the one generating the message even though you might be doing it on "behalf" of the person creating the item. (Check the example in RFC822 for a example of this usage)

Let us know what you think.

Thanks for the consideration.


Attachments (2)

pluggable-functions.php.2.diff (1.7 KB) - added by markjaquith 15 years ago.
patch for wp 1.6 SVN (take 2)
reply-to.diff (607 bytes) - added by markjaquith 15 years ago.
Oops, incomplete patching. This will put in the missing part.

Download all attachments as: .zip

Change History (14)

#1 @Bernard_J_L
15 years ago

  • Version changed from 1.2 to

Has there been any changed to this? Today I noticed another failed email message due to "sender not in domain". We are going to have to look around to see where this comes from. Seems like I am always looking for this one.

Thanks again for a great product and hope this gets corrected. I would think others would start having this problem also.


This is on version

#2 @markjaquith
15 years ago

  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

I've been having this problem as well. We need to start specifying a From address. I'll work on a patch.

#3 @markjaquith
15 years ago

  • Milestone set to 1.6
  • Resolution set to fixed
  • Status changed from assigned to closed

Okay, looked into it... and it is fixed in 1.6 using wp_mail(), if the 4th param (headers) is blank, it provides a From:

#4 @westi
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm not convinced this is fixed so reopening.

wp_notify_postauthor in trunk/wp-includes/pluggable-functions.php calls wp_mail() with a non-blank headers which includes already a From: line with the commenters email address in it:

        if ('' == $comment->comment_author_email || '' == $comment->comment_author) {
                $from = "From: \"$blogname\" <wordpress@" . $_SERVER['SERVER_NAME'] . '>';
        } else {
                $from = 'From: "' . $comment->comment_author . "\" <$comment->comment_author_email>";

        $message_headers = "MIME-Version: 1.0\n"
                . "$from\n"
                . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";

#5 @markjaquith
15 years ago

Bah, you're right. I'll work on a patch. Thanks.

#6 @markjaquith
15 years ago

  • Keywords bg|has-patch added

Try that patch on for size.

15 years ago

patch for wp 1.6 SVN (take 2)

#7 @skippy
15 years ago

  • Keywords bg|squashed added

confirmed works for me

#8 @markjaquith
15 years ago

  • Keywords bg|commit added

#9 @matt
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [3035]) Use reply-to instead of from to stop acting spammy - fixes #1593

15 years ago

Oops, incomplete patching. This will put in the missing part.

#10 @markjaquith
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The last part of the patch didn't make it into the commit. The $reply_to var is being set, but the part where it is added into the headers is missing. The second patch fixes it.

#11 @matt
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [3048]) Missed a line, fixes #1593

#12 @(none)
14 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.