Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Help with $replyto please
Avatar
Roy Costa
Member
sp_UserOfflineSmall Offline
Mar 6, 2016 - 8:08 pm

And I should add - I don't have any other functions that would conflict, as far as I know. I also tried changing the code to use my specific personal email and that didn't work either...

add_filter('sph_email_replyto', 'my_reply_to', 99, 2);

function my_reply_to($reply, $newpost) {
    $reply = 'MY OWN EMAIL';
    return $reply;
}
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 6, 2016 - 8:22 pm

No, thats not how to paste code...  see image for highlighted code then hit circled button and select php or appropriate language... want this because I see illegal chars in what you posted.. but again, that would cause errors...

code.pngImage Enlarger

you did not answer my question back in #8 at bottom
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 6, 2016 - 8:24 pm

re filter and other plugins...  oh, okay, I thought you were using our html email plugin based on a different topic... which uses the same filter as does a couple of our other plugins...

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 6, 2016 - 8:43 pm

I dug into this a bit more - that is, what are wp and sp actually doing here..  and despite the name, we/they are not really updating the reply-to header for emails...  what is actually being done is updating the from email address... 

so, if code all correct, then its possible that your host is rejecting an email that is not from your server domain...

I have opened up an enhancement ticket to see if we can actually work with wp to adjust the reply-to header of emails rather than the from address...

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 6, 2016 - 9:10 pm

If this is indeed your problem, you might try getting around it this way:

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) {
    $atts['headers'] = 'email@domain.com';
    return $atts;
}

this would add a new filter to the wp mail arguments when we are getting ready to send post notifications..  this filter would modify the wp headers to add the reply-to header...  the third filter then removes the wp mail filter when we are done sneding notifications...

have to say, untested... 🙂

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 6, 2016 - 9:15 pm

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

Avatar
Roy Costa
Member
sp_UserOfflineSmall Offline
Mar 6, 2016 - 9:16 pm

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.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 6, 2016 - 9:17 pm

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

Avatar
Roy Costa
Member
sp_UserOfflineSmall Offline
Mar 6, 2016 - 9:19 pm

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.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 6, 2016 - 9:20 pm

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

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 649
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 616
Members: 17348
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10118
Posts: 79603