• Resolved wywalk

    (@wywalk)


    I have a pretty specific need, and am absolutely willing to pay for a customization.

    We’re using Subscribe2 to create a sort of a mailing list/hotline. Subscribers post a request, which is then broadcast to anyone subscribed to that category. If anyone can assist with that request, he/she responds to the original post-er.

    I’ve been able to hack past versions, so that the email header displays, as follows:

    From: Author of Post <admin email address>
    Subject: Title
    To: Subscriber Email
    Reply-To: Author of Post <author email address>

    Worked perfectly, because users were able to whitelist the Admin email address, but could hit reply and contact the person making the request directly. And when viewing notifications in their Inboxes, could see who was making the request.

    But, for some reason, I haven’t been successful at hacking Version 9.0, so I haven’t been able to update. And we’ve been having issues with notifications not being sent (seems totally random – 3 or 4 will go out perfectly, then 2 don’t, then 6 go out, then 1 doesn’t).

    Could you give me a hand with this? I know it’s not a modification that will have wide-ranging application – I am absolutely willing to pay your going rate, and have made an initial token donation, to get your attention ;o)

    Thank you!!
    Julia

    http://ww.wp.xz.cn/plugins/subscribe2/

Viewing 12 replies - 1 through 12 (of 12 total)
  • @julia,

    Thank for the donation you sent, I have replied with a solution by email for you. You need to make use of a hook in Subscribe2 to change the default behaviour and by creating a plugin to Subscribe2 you will hopefully avoid the need to hack the code after each release too.

    This is what I came up with and I think it worked on my test site too.

    function custom_reply_to($header) {
    	global $post;
    	$author = get_userdata($post->post_author);
    	$header['Reply-To'] = html_entity_decode($author->display_name, ENT_QUOTES) . " <" . $author->user_email . ">";
    	return $header;
    }
    
    add_filter('s2_email_headers', 'custom_reply_to');
    Thread Starter wywalk

    (@wywalk)

    Thanks so much for the solution, but alas, it doesn’t seem to be working.

    This is what I need:
    From: Author of Post <admin email address>
    Subject: Title
    To: Subscriber Email
    Reply-To: Author of Post <author email address>

    And this is what the function is doing:

    From: Admin Name <admin email address>
    Subject: Title
    To: Subscriber Email
    Reply-To: blank

    Just in case I’m being clueless, I added the function to the functions.php doc in my theme (which happens to be a child theme)

    @julia,

    What was in the email header before the functions was applied? Sometimes web servers remove or rewrite the Reply-To header immediately prior to sending.

    @julia,

    In fact try this instead, in the Subscribe2->Settings page set the sender in the drop down to be the Post Author.

    Then update the function code to this:

    function custom_reply_to($header) {
    	$header['From'] = preg_replace('|<[^>]*>|', "<TYPE YOUR ADMIN EMAIL HERE>", $header['From']);
    	return $header;
    }
    
    add_filter('s2_email_headers', 'custom_reply_to');

    Thread Starter wywalk

    (@wywalk)

    So close!!

    The sender is set, in Settings, as the Post Author, and now I’m getting:

    From: WordPress <Author-of-Post [email protected]>
    Subject: Title
    To: Subscriber Email
    Reply-To: Author of Post <author email address>

    We just need to move Author-of-Post outside the < > to replace WordPress

    @julia,

    What is the From: address without the code running? Does is come through as Author of Post <author email address>? Are there any non-alpha-numeric characters in there?

    Thread Starter wywalk

    (@wywalk)

    Yes, it comes through as Author of Post <author email address>. The only non-alphanumeric characters are the <> around the email address …

    @julia,

    That’s strange, when I tested the code on my testing site it only replaced the content between the <> brackets.

    Thread Starter wywalk

    (@wywalk)

    Finally getting back to playing around with this.

    I tried the following:

    function custom_reply_to($header) {
    	$header['From'] = preg_replace('|<*>|', "[email protected]", $header['From']);
    	return $header;
    }

    and got the following:

    From: Author-of-Post <[email protected]>
    Subject: Title
    To: Subscriber Email
    Reply-To: Author of Post <author email address>

    The Author Email was still in the brackets, with no space between it, and [email protected].

    It seems like it’s not replacing, but just adding the replacement string.

    Any thoughts?

    @julia,

    The regular expression in your code above is not the same as I used which may explain the difference. use ‘|<[^>]*>|’ instead of |<*>|.

    Thread Starter wywalk

    (@wywalk)

    Yes, I was playing around with slight adjustments, trying to get it to do exactly what we want it to do.

    Using this:
    |<[^>]*>|’
    produced this:
    From: WordPress <Author-of-Post [email protected]>

    Clients were complaining that they couldn’t tell who the post was from.

    So I fiddled around and tried this:
    |<*>|
    which produced this:
    From: Author-of-Post <[email protected]>

    which solved the problem of not seeing the author name, but now, emails are getting dumped into Spam folders, as clients have whitelisted the email, and it now looks as though it’s coming from somewhere else.

    In the first instance, I need to move Author of Post outside the brackets, replacing WordPress. In the second instance, I need to get rid of the Author Email within the brackets.

    @julia,

    Please can you paste the code you are using here or email it to me.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Question about "Reply to:"’ is closed to new replies.