#2618 closed defect (bug) (fixed)
Default "do not reply" email address needs a filter
Reported by: | sudar | Owned by: | netweb |
---|---|---|---|
Milestone: | 2.5.6 | Priority: | highest omg sweet tea |
Severity: | major | Version: | 2.5.4 |
Component: | API - Subscriptions | Keywords: | has-patch |
Cc: | sudar@…, unsalkorkmaz@… |
Description
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 an 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 https://bbpress.trac.wordpress.org/browser/trunk/src/includes/common/functions.php#L1065
$do_not_reply = '<noreply@' . ltrim( get_home_url(), '^(http|https)://' ) . '>';
So it becomes <nobody@…>
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. It would be nice to add a filter so that if people (like me) need to change it can change it using a filter instead of modifying the core files.
I can prepare a patch if needed.
Attachments (6)
Change History (35)
#2
@
10 years ago
- Component changed from Actions/Filters to Subscriptions
- Keywords has-patch added; dev-feedback removed
- Milestone changed from Awaiting Review to 2.6
- Owner set to netweb
#3
follow-up:
↓ 4
@
10 years ago
There is still one small issue in the patch.
The bbp_subscription_do_not_reply
filter is applied to $do_not_reply
after it is included in from
address.
Can we move the apply_filter
line before it $do_not_reply
is added to the from address? In that way a plugin developer can change both the from and to email address.
#4
in reply to:
↑ 3
@
10 years ago
Replying to sudar:
There is still one small issue in the patch.
The
bbp_subscription_do_not_reply
filter is applied to$do_not_reply
after it is included infrom
address.
Can we move the
apply_filter
line before it$do_not_reply
is added to the from address? In that way a plugin developer can change both the from and to email address.
Thanks, missed that ;) Fixed in 2618.2.diff
#5
@
10 years ago
While we are at it, I thought it would make sense to use separate filters for the from and to addresses and modified the patch 2618.3.diff
#7
@
10 years ago
As stated in https://bbpress.trac.wordpress.org/ticket/2162#comment:27, we are also having issues with the recent changes in our mail setup, specifically due to the way the noreply-address is generated which results in delivery erros due to a missing MX-record.
Right now, notification-mails are sent to noreply(AT)www.our-site.info which causes errors (should be noreply(AT)our-site.info).
Both home_url and site_url are set identically (www.our-site.info) and we are redirecting traffic from non-www to www on a server-level. Other than that we have had no problems whatsoever with other plugins / mail configurations appending 'www' to email-addresses so this seems to be pretty bbPress-specific.
Seeing that the filter will be moved I am hoping that our setup (using GD bbPress Toolbox for our notifications) can tweak the from-address...
Thanks for your efforts / support!
#8
@
10 years ago
See also http://bbpress.org/forums/topic/reply-email-notifications-are-not-being-sent/
Quite sure we need to strip any www
characters that are included with get_home_url
, it would be rare for any setups to be including www
as a mail alias as part of the domain name in their DNS configurations.
#10
@
10 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Via bbpress.org
Using the current method:
$email = 'noreply@' . str_replace( 'www.', '', ltrim( get_home_url(), '^(http|https)://' ) );
Results in ltrim's 'character mask' (not a regular expression) stripping all the s's
eg http://ssssssseanwes.com/
or https://ssssssseanwes.com/
becomes eanwes.com
Patch 2618.4.diff strips http://
, https://
and www.
if they exist in get_home_url()
$email = 'noreply@' . str_replace( array( 'http://', 'https://', 'www.' ), '', get_home_url() );
#11
@
10 years ago
Notes: The WordPress plugin wpMandrill does not support a BCC: list of email users, associated discussion here. If you are a wpMandrill user for now you will need to disable sending bbPress notification emails with the Mandrill API until BCC support is added to wpMandrill, this plugin will do that.
#12
@
10 years ago
If you are a wpMandrill user for now you will need to disable sending bbPress notification emails with the Mandrill API until BCC support is added to wpMandrill, this plugin will do that.
Or you can this plugin which allows you to send bcc emails through wpMandrill.
#13
@
10 years ago
i have the exact same problem like leanderbraunschweig.
both home-url and site-url contain www.site.com .
and since the last update of bbpress, the $do_not_reply variable causes an annoying error which results in a mail delivery error:
<noreply@www.site.com>: mail for www.site.com loops back to myself
how do i remove the www ?
at the moment i changed line 1065 and 1205 to
$do_not_reply = '<noreply@' . ltrim( get_home_url(), '^(http|https)://www.' ) . '>';
which works as expected
#14
@
10 years ago
Right now the only option is to change the code like how you did. The issue that you are facing is fixed and hopefully the fix will be available as part of the next release of bbPress. @netweb might be able to give the approximate date of release of next version of bbPress.
#15
@
10 years ago
Hello -
Seems I am also caught in the same "Mandrill won't send to more than one Bcc address" . . .
Sudar - THANK you -- your plugin DOES work for me.
However -- I have one other issue with it . . . (forgive me, I'm NOT a programmer / coder . . more just a 'hacker' - so I hope I'm not asking a really stupid question here) . . . .
When I use Sudar's plugin - it seems to fix the Mandrill issue - and sends to all subscribers (yay!)
-- The problem is: a second email is also being sent to all subscribers -- and that one is NOT going through Mandrill
(maybe this is due to another plugin interference - I don't know yet)
I need to use Mandrill for ALL emails that go out from my site - or my web host will shut me down for abuse.
Is there a way that I can use Sudar's plugin -- and also 'block' all other wp-mail from going out?
Thanks in advance - for any help you can send my way - I will keep working (in "hacking mode" in the meantime.
#16
@
10 years ago
- Priority changed from normal to highest
- Severity changed from normal to major
#2701 was marked as a duplicate.
We can use str_replace
2618.4.diff patch:
$email = 'noreply@' . str_replace( array( 'http://', 'https://', 'www.' ), '', get_home_url() );
Or alternitively preg_replace
per DJPaul's patch in #2701 (Slightly modified regex than the bbpress-2701.01.patch)
$email = 'noreply@' . preg_replace( '^(https?:\/\/)(www\.)?', '', get_home_url() );
#17
@
10 years ago
Finally i found the problem but i seriously didnt expect that bbpress core is the problem, lol.
My site is: http://theme.firmasite.com
I was getting lots of Delivery Status Notification to
noreply@eme.firmasite.com
Did you realize the problem? Site adress is theme.firmasite.com but system trying to send it to eme.firmasite.com
This ticket was mentioned in Slack in #bbpress by netweb. View the logs.
10 years ago
This ticket was mentioned in Slack in #bbpress by sudar. View the logs.
10 years ago
#22
@
10 years ago
In 2618.5.diff I've used @DJPaul's patch from #2701 as these will correctly ignore casing if capital letters happened to be used for some reason in get_home_url()
#23
@
10 years ago
In 2618.5-25branch.diff is for the 2.5 branch as r5409 only exists in /trunk
as part of the 2.6 milestone.
Thanks, I'd say this slipped past us as some mail servers were automatically stripping the brackets.
We are using
$do_not_reply
for both the To: and From: email addresses wp_mail expectsTo:
addresses to be formatteduser@example.com
, not<user@example.com>
, the email address only gets wrapped in brackets when using a name and email as bbPress does for theFrom:
headers e.g.User <user@example.com>
.Patch moves the brackets from
$do_not_reply
to the$headers
and also adds abbp_subscription_do_not_reply
filter for forum and topic subscriptions. The same filter is used for forum and topic subscriptions similar to the custom headers filterbbp_subscription_mail_headers
Related: r5259 This changeset fixed the
From:
without taking into account$do_not_reply
is also used forTo: