1

So, I don't know how to explain properly, but here is the current situation.

Let say the site is called "Demo.com" and site admin email is "admin@gmail.com"

Then,

  1. An author(example, user-X@gmail.com) posts a post.
  2. a visitor (another user, user-Y@gmail.com) leaves a comment or reply on the post.
  3. the author(user-X) gets an email notification.

Here is the thing.

The email sender is the admin "admin@gmail.com" and not the visitor.

Thus, when the author tries to reply back directly from the email, he is replying back to the "admin@gmail.com" and not "user-y@gmail.com".

How can I change it so that the reply can be sent to the original viewer (user-y)?

Any suggestions?

1

What you need to do is to modify the code that sends the email to the author and in it set the "reply-to" header of the email, pass it as part of the headers parameters to wp-mail.

Your code should be something like (adapted from the php mail function documentation).

$to      = 'author@example.com';
$subject = 'new comment';
$message = 'hello';
$headers = 'From: admin@gmail.com' . "\r\n" .
    'Reply-To: user-y@gmail.com';

wp_mail($to, $subject, $message, $headers);

Of course you will need to get the relevant email addresses from the post author and the comment author fields, and you will probably want to specify the "nice names" of all the people involved with the actual email address

| improve this answer | |
  • Thank you for the reply. I will give that a try and post what I did to make it work (when it works). Thanks! – Steve Kim Mar 27 '15 at 4:23
0

you could use this filter: comment_notification_headers

for reference:

https://core.trac.wordpress.org/browser/tags/4.1/src/wp-includes/pluggable.php#L1434

line: 1434 and 1471

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.