Problem with the default "do not reply" email address
-
With the recent bbPress update, the way notification is sent is changed. Earlier individual emails are sent to each people, but now only one email is sent with all the email address in bcc. I guess this is done to prevent email bottleneck. But this seems to have caused a issue in my setup.
I use wpmandrill to send emails through the mandrill service. With the new change, the to and from address is changed to a default “do not reply” email address that is calculated using the current domain name. The code is present in the
bbpress/includes/common/functions.php
$do_not_reply = '<noreply@' . ltrim( get_home_url(), '^(http|https)://' ) . '>';
So it becomes <nobody@domain.com>
When this address is used as “to” address, the mandrill service thinks that it is an invalid email address because of the angle brackets.
I went through the code, but there is no filter to change the
$do_not_reply
variable.
-
I just found myself in this situation as well, took me a while to figure out what happened but you’re right when it comes to wpMandrill. I’ve just made the change a few minutes ago by hard-coding an email address Mandrill knows about, but I’m not sure how it’s going to react to BCC’ing all the recipients. Have you had any luck in testing/verifying it still works?
It looks like the issue is compounded by
// Setup the From header $headers[] = 'From: ' . get_bloginfo( 'name' ) . ' ' . $do_not_reply;
as well. Mandrill complains that the format isn’t an email address and fails validation. Not sure if this is a change in the latest bbPress update but I had to modify that as well.
Running a few tests, it looks like the new BCC setup continues to work as expected through Mandrill.
Yes, Mandrill don’t like the angle brackets in front of the email address.
The patch that I made for this just got merged into bbPress trunk https://bbpress.trac.wordpress.org/ticket/2618
Bcc’ing all subscribers didn’t cause any issue with mandrill for me after I removed the angle brackets from the do_not_reply email address.
Mandrill complains that the format isnβt an email address and fails validation.
The issue I am presuming here is that that the from address is being generated as noreply@www.example.com, we are also now stripping the www as most setups won’t include a www alias for their mail server configuration.
If you test this and run into any issues please let us know. π
Changeset 5409 fixed it for me.
However, I still have the following issue:
My website is seanwes.com. Notifications are now coming from noreply@eanwes.com (notice no ‘s’).
I have the proper address hardcoded in the mean time.
I’ll take a look at that now Sean…
Ha! Confirmed, will add an updated patch shortly….
It strips all the ssssssssss’s so even
https://sssseanwes.com/
becomes @eanwes.com πI have just added a patch, you need r5409 applied before adding 2618.4.diff
I’m using wpMandrill too and my emails are still being rejected after applying r5409. I’m guessing this is because I now need to hook into one of the new filters to change the noreply to a valid/real email address. Is that correct? If it is, which filter should I hook into? Right now, the only way I’ve been able to get my notifications working again was to revert the functions.php file the version in 2.5.3. I know this band-aid isn’t the best method but at least I’m up and running again, I’d like to make sure I have this fixed correctly for future updates.
Last question … is it going to be possible to revert to the previous method of send notifications without having to hack core files?
@shazahm1hotmailcom Did you also add 2618.4.diff to the r5409 changeset you tested?
You should not need to use one of the filters to have the correct email address, they are only there if you need to specifically override the email address.
We’d also like to have this fixed and not break any sites or backwards compatibility and are pretty sad it has at the moment π
Could you explain what you mean regarding ‘revert to the previous method of send notifications’?
Yes, I did both. 2618.4.diff would not affect me though. I did verify the email address was correct in the Mandrill dashboard, noreply@connections-pro.com, but they were still being rejected.
I made sure to deactivate two plugins I’m using to make sure they were not inferring just incase they need to be updated to work correctly with the bcc change.
Those plugins were:
https://wordpress.org/plugins/bbpress-custom-reply-notifications/
https://wordpress.org/plugins/bbpress-new-topic-notifications/I saw that both @jchristopher and @sudar mention they had to hardcode an email address that wpMandrill knows about. I’m wondering if I need to use one of the new filters to change the noreply address to a real valid address for wpMandrill to send the email without rejecting it. If I could figure out what they did to resolve their issue, but use a filter instead of hard coding it, that seems like it would solve my problem in a update safe way.
For now I’m still using the functions.php file from 2.5.3 (I have 2.5.4 installed).
What I mean by previous method is, in 2.5.4, notifications are sent as a “group” bcc was as in 2.5.3 it was one email per notification (right?).
The solution lies in : wp-content/plugins/bbpress/includes/common/functions.php
Currently it is this :
$do_not_reply = '<noreply@' . ltrim( get_home_url(), '^(http|https)://' ) . '>';
Needs to be:
$do_not_reply = '<noreply@' . str_replace("www.","",ltrim( get_home_url(), '^(http|https)://' )) . '>';
I got this issue on my server w the latest bbPress update. I believe the most recent ticket will fix it in the next update, but this is what we did internally and it’s working.
Another twist for those of us that use Mandrill βΒ
$do_not_reply
is used for both the to address and the from address. In order to get around Mandrill requiring the from address being legit and on file I first had to change$do_not_reply
to be my main Mandrill address, which in turn addressed every single email to my actual email address instead of one that is intended to go nowhere.I made another edit and customized the From address in
$headers
and all is well, but it’d be great to have both be separate filters for cases like this where the from address needs to be legit.There are two reasons why the email fails
–
www
was appended in front of the domain name.
– The email address is enclosed with angle bracketsFor me the
www
issue didn’t happened but it was because of the second issue.Once I removed the angled brackets it worked for me through wpmandrill. But you will get a bounce email if that email doesn’t exist.
To actually find whether the email went through or not, check the api logs from the mandrill dashboard. Even though you are getting a bounce email, the emails might have gone to all your subscribers who are added in bcc.
A third reason was that we were not accurately removing the
http://
/https://
which could result in domains likehttps://sssseanwes.com/
removing all the s’s becomingeanwes.com
πOnto the biggest issue is that the wpMandrill plugin for WordPress DOES NOT support BCC:
In the help overview of the wpMandrill plugin there is this: (emphasis mine)
Note that if you’re sending additional headers in your emails, the only valid headers are From:, Reply-To:, and X-*:. Bcc: is also valid, but Mandrill will send the blind carbon copy to only the first address, and the remaining will be silently discarded.
I asked Mandrill about this this morning:
@netweb Not for that specifically, but this article on modifying the payload in wpMandrill is a great starting point: http://t.co/e9jmRTdbV4
— Mandrill (@mandrillapp) June 18, 2014
Where to next I’m not sure, I’ve only just started to take a look at Mandrill as I’ve never used it before, ideally if the wpMandrill plugin supported the full Mandrill API then using BCC would not be an issue.
Onto the biggest issue is that the wpMandrill plugin for WordPress DOES NOT support BCC
Oops! and thanks for catching it. I tested it one bcc address and it worked. So I assumed that it works for all the email address that were sent in bcc.
Ah ha great catch. So for those of us in this boat what would be the best course of action to take to immediately get back up and running? Is it safe to roll back in any way until the next version of bbPress is released?
Probably disable wpMandrill for bbPress notifications would be the quickest way and let WordPress’ send the emails as BCC is fully supported.
You can try the following plugin that I whipped up, I have only tested it on a local install and works for me…
https://gist.github.com/ntwb/d45948672dbf5fd580c9
That said, if you already have custom functions using the wpMandrill
mandrill_payload
filter in another plugin or functions.php file then updating the relevant section of that for bbPress would be the suggested route. I’m also not sure how this will affect any other templates or custom configurations you may be using either via the wpMandrill plugin config options or any options you have set in your Mandrill API/Setup/Config. (As stated, I’ve only just fired up wpMandrill to have a a quick look for the first time a couple of hours ago)Thank you so much for your efforts with this!
Yes, @netweb, thanks for digging into this!
Unfortunately bbPress notification was one of the primary the reasons I searched for and ended up using Mandrill, so bypassing it is not really an option for me.
I really have not delved too deep in the bbPress notification functions for action/filters … are there sufficient actions/filters hooks in place for me to write my own plugin which will restore the pre 2.5.4 notification functionality?
@Shazahm No, I haven’t looked at what would be required to achieve this.
The core of the issue from the bbPress side of this is that once you start getting a a large amount of subscribers to forum or topic notifications sending individual emails to each of these users is a significant performance hit or webhost issues with outbound SMTP limits.
I linked this conversation to @Mandrill last night and their reply:
Thanks for the additional info. We’re working to improve the wpMandrill plugin with additional features, but no ETA at this time.
As I previously stated above, the fact that BCC is a valid email address formatting technique but wpMandrill does not support this then it is hard for bbPress to make a workaround to support a plugin that does not support valid RFC internet email standards.
We’re happy to add extra hooks and filters into bbPress where needed to help facilitate having wpMandrill work with bbPress but someone who knows and understands wpMandrill and the Mandrill API is going to have to give us a hand here.
Weβre happy to add extra hooks and filters into bbPress where needed to help facilitate having wpMandrill work with bbPress but someone who knows and understands wpMandrill and the Mandrill API is going to have to give us a hand here.
Okay guys, some good news π
After spending almost the entire day, I finally found a way to get around the “only one bcc email” restriction of Mandrill API. Basically Mandrill API provides a way to trigger individual emails for a list of individual email address. To do that we need to add the list of email address to the the “to” column in a array with type as “bcc” and then set “preserve_recipients” to false.
After I found this I wrote a small plugin by filtering the
wp_mail
filter and then parsing the “bcc” header and then adding the emails to the “to” array. The full explanation and code is available at http://bulkwp.com/blog/using-wpmandrill-to-send-subscription-notification-from-bbpress/Note: Strong disclaimer. It currently works for me but there may be lot of corner cases. So first check it in your dev server before adding to a live server.
Huge thank you for those that investigated this and looked into it further. I’m currently trying out @sudar’s plugin to see if this works for me. I have wpMandrill and it seems to be stripping out the first letter email address. Mine URL is travelblogsuccess though so it does not have the S as someone else had described here. I’ll report back soon.
I’ve just discovered i’m having the same issue where notifications aren’t being sent via WPmandrill. Mentions are fine but notifications and subscriptions are broken.
I’ve installed the bbPress – Subscription in Mandrill plugin and tried editing the “do not reply” email addresses in “bbpress/includes/common/function.php” file the but still get no notifications.
Do i need to to anything else?
- You must be logged in to reply to this topic.