Support Forum

Help with $replyto please

21 Answers

New Answer

MP Mr Papa
Mr Papa
Member

actually, you wanted the poster, so maybe this hacky fix…

add_filter('sph_admin_email_addresses', 'my_add_replyto_filter');
function my_add_replyto_filter($dummy) {
    add_filter('wp_mail', 'my_replyto');
    return $dummy;
}

add_filter('sph_new_post_notifications', 'my_remove_replyto_filter');
function my_remove_replyto_filter($dummy) {
    remove_filter('wp_mail', 'my_replyto');
    return $dummy;
}

function my_replyto($atts) {
    global $spGlobals;
    $atts['headers'][] = 'reply-to: '.$spGlobals['replyToAddress'];
    return $atts;
}

add_filter('sph_email_replyto', 'my_reply_to', 99, 2);
function my_reply_to($reply, $newpost) {
    global $spGlobals;
    $spGlobals['replyToAddress'] = $newpost['posteremail'];
    return $reply;
}

still untested

RC Roy Costa
Roy Costa
Member

Will try that coding.

Yes, I am using SP email address settings under options.  There, I put the blog admin email as the sender.  And yes, I think the host would block me as you say.

MP Mr Papa
Mr Papa
Member

please be sure to check my last..  I did a couple of edits about the same time you posted…

RC Roy Costa
Roy Costa
Member

Okay I tried that code.  The email went through.  I put my own email (just for testing) as the reply-to.  But when I actually reply to the email (in gmail), it defaulted to going back to Email_A.

MP Mr Papa
Mr Papa
Member

are you sure it was my latest?  the one with reply-to: as a string?

RC Roy Costa
Roy Costa
Member

Yay!  Sorry I missed the latest post you made and that seems to work now.  Fantastic!

MP Mr Papa
Mr Papa
Member

sweet!  good news!  thanks for confirming..  as I mentioned, I did open a ticket to see if we should really support the reply-to header as our filter is really misnamed…