Forums

WP2.1 - comment "from" field in notification is different (11 posts)

  1. stgm
    Member
    Posted 5 years ago #

    I upgraded to WP 2.1 from 1.5 two weeks ago, and almost everything went swimmingly. The only change I've noticed that I'm not too thrilled about is the e-mail notification to me whenever someone leaves a comment. Before, I'd get an e-mail, and the "From" field would show the commenter's name as entered on the comments field. Now, however, it always shows my account name with my webhosting provider (my blog is set so that you can't leave the name field blank).

    I've gone through all the options available under WordPress, but can't find anything about this. Is this something I can modify one of the php files to revert back to showing the sender's name?

    Thank you for any help.

  2. stgm
    Member
    Posted 5 years ago #

    So no one else has come across this problem? :-(

  3. Otto
    Tech Ninja
    Posted 5 years ago #

    I'm looking at the code for 1.5.2 now, and the "From:" line in that was not the commenters information, it was the admin's own email address.

    In 2.1, the From: line is wordpress@example.com, except it's your server's name instead of example.com.

    Edit: in 1.5-strayhorn, it did indeed use the comment author's info as the From address. I believe this was removed for a variety of reasons. The ones I can think of are:
    -Some providers will block emails with bad/fake From: addresses.
    -Some receiving email systems will do the same.
    -It's easy to filter emails when you know what they'll have.. A From: of "wordpress@..." is easy to create filters to catch and sort and such.

    And so on.

  4. stgm
    Member
    Posted 5 years ago #

    Hi Otto42,

    Thank you for the reply and for the explanation. At least now I know it's not a problem with my installation of 2.1 per se.

    Thanks again.

  5. anaglyph
    Member
    Posted 5 years ago #

    I'm seeing a problem that may be similar - when people leave comments the 'Name' field is sometimes auto-filled for them, but with a name different to their own (usually someone who has recently commented). It's now happened under 2 and 2.1.

    If they post to the blog with this name the post 'takes' but also gets reported to me as a mail delivery failure.

  6. mrouzas
    Member
    Posted 4 years ago #

    I'm having the problem with the "from" line of my email comment notification with WP 2.2 and am DESPERATE to get it fixed. I need to have the name or email address of the commenter displayed in the "from" portion of the email notification. Is there anyone with any ideas about how to change the "from" line from the host's routing to the actual commenter's name or email?

  7. faschenk
    Member
    Posted 4 years ago #

    I had this same problem too, so I searched in the code. NB: Version 2.3.2.

    The file:
    wp-includes\pluggable.php

    around line 550, new code:

    $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
    
    	if ( '' == $comment->comment_author ) {
    		$from = "From: \"$blogname\" <$wp_email>";
    		if ( '' != $comment->comment_author_email )
    			$reply_to = "Reply-To: $comment->comment_author_email";
    	} else {
    		if ( '' != $comment->comment_author_email ) {
    			$from = "From: \"$comment->comment_author\" <$comment->comment_author_email>";
    			$reply_to = "Reply-To: \"$comment->comment_author\" <$comment->comment_author_email>";
    		} else {
    			$from = "From: \"$comment->comment_author\" <$wp_email>";
    		}
    	}
    
    	$message_headers = "$from\n"

    (The first few and the last line haven't changed, so locating the code shouldn't be too hard...)

    This works here since the mail-server doesn't filter the mail. YMMV.

    With kind regards,

    Fred Schenk

  8. Otto
    Tech Ninja
    Posted 4 years ago #

    Regardless of the contents of the From: line, it's also setting the Reply-To: header to be the correct email address, so replying to the email should send a response back to the submitted, not to the fake wordpress@ address. No need to hack it unless you really want to.

  9. definitelyra
    Member
    Posted 4 years ago #

    I have set up a wordpress@domain email address, installed the comment notifier plugin, and used the new code above, but the only way I can get emails to go to my admin email address is to forward them from my wordpress@domain email address, which negates the author in the From field.

    I have tried every solution I could find on the forum, but I can't seem to get emails sent to my admin address (a gmail address) with the author in the From field.

    I am using WP 2.3.2.

  10. definitelyra
    Member
    Posted 4 years ago #

    Of course, the second I submit this question, the emails pop up. Maybe I should have done that sooner.

  11. JosiahR
    Member
    Posted 4 years ago #

    Is it resolved? Just wondering. :)

Topic Closed

This topic has been closed to new replies.

About this Topic