Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SparkPost doesn't send bbPress subscription notifications -- might be bcc issue?? #31

Closed
cfk4spk opened this issue Apr 12, 2016 · 14 comments

Comments

@cfk4spk
Copy link

cfk4spk commented Apr 12, 2016

Currently, this works with Mandrill but does NOT work with SparkPost:

Our website (WordPress) uses bbPress (forum plugin).
It allows members of our site to "Subscribe" to forum topics if they choose.
That works with Mandrill.
It does not work with SparkPost.

Can you help to figure out what SparkPost needs --- so that this will work?

Here is some info that MIGHT be 'helpful' . . .
We had needed to use a workaround ("Sudar-Fix") to make Mandrill work for the subscriptions when bbPress was at an earlier version (I can figure out the exact version, if helpful - let me know).
bbPress has apparently "incorporated" the "Sudar-Fix" into it's core, and we no longer need it, for Mandrill to work with bbPress subscriptions.

SparkPost does not work for bbPress subscriptions -- with or without the Sudar-Fix.

You can find the "Sudar-Fix" here:
http://bulkwp.com/using-wpmandrill-to-send-subscription-notification-from-bbpress/
and github info:
https://github.com/sudar/bbpress-subscription-in-mandrill

It DOES appear that SparkPost DOES work for bbPress subscriptions - when using an old version of bbPress (bbPress 2.5.3) -- but does not work with the current bbPress 2.5.8 -- I do not know for certain, at which version it stopped working, but I can try to determine -- if it might be helpful. (?)

Any advice / help / etc would be GREATLY APPRECIATED!
Please let me know if I can help --- I will try to provide any info that might help!

Thanks in advance,
Chris

@rajumsys
Copy link
Contributor

Hello @cfk4spk
Thanks for reporting. We'll investigate this issue for you and will follow up.

@rajumsys
Copy link
Contributor

Following up about the issue, I see there is a reason why HTTP API not working. However, if it's the same issue, SMTP version should work. Have you tried SMTP?

@MichaelPereiraUK
Copy link

The cause of the issue may be similar to what I noted in #32

@cfk4spk
Copy link
Author

cfk4spk commented Apr 14, 2016

Hi rajumsys -
Thank you for following up - my apologies for my delay in getting back to you . . .
I have been trying to get SMTP to work, but I'm having no luck - as I've been unable to get anything through that way.
I may be erring, and I will keep trying! I had THOUGHT that we 'needed' to use HTTP API for our scenario (see below), but I'm willing to try whatever may work for us!

Regarding MichaelPereiralUK's suggestion, I'm unsure whether it applies for me or not. I know that BuddyPress uses bbPress, but also that the two work differently, in some ways, at least. Unfortunately, I am not a programmer / developer, and I am not sure that I understand well enough to confirm or deny. I am happy to try anything -- and / or to provide any info that might be helpful -- if you / he can tell me what you'd like to see?!?

With Mandrill we used HTTP API --- and that led me to believe that I should be using HTTP API with SparkPost also. If I can / should be using SMTP, I am happy to make the change -- if I can figure out how.
Right now, my SMTP test emails tell me that they are sent successfully, but no emails are coming through, and my SparkPost 'report' does not show them at all --- and so far, I cannot get any emails to work through bbPress when SparkPost is set to SMTP.

SparkPost IS working for us -- using HTTP API --- for our bbPress forums . . . IF I do not update bbPress beyond version 2.5.3.
When I use bbPress2.5.3 -- the forum subscriptions work fine with SparkPost.

When I update bbPress to its current version: 2.5.8 --- the subscriptions no longer work (and they stopped at bbPress2.5.4).
The rest of our bbPress and other emailing needs seem to be working with SparkPost --- it is ONLY the bbPress subscription emails that do not work with SparkPost -- when bbPress is updated beyond version 2.5.3 (but this DOES work with Mandrill -- so I believe it is something within SparkPost that is killing it . . . please read on)

When bbPress was updated to version 2.5.4 -- one of the changes includes this:
(from bbPress2.5.4 includes->common-> functions.php):
" . . . we've moved away from 1 email per subscriber to 1 email with everyone BCC'd. This may have negative repercussions for email services that limit the number of addresses in a BCC field (often to around 500.) . . . "

I'm not sure if that is 'why' SparkPost works with version 2.5.3 and does not work with version 2.5.4 - 2.5.8 --- I am merely hoping to help provide info.
With Mandrill, we had needed to use what I called the "Sudar-Fix" -- with bbPress2.5.3 ---- but WITH that, Mandrill works with bbPress2.5.3
Mandrill also works with bbPress2.5.8 ("Sudar-Fix" no longer needed, as they apparently 'incorporated it' into bbPress core)


I will try here, to provide a few more details about our setup, in case it is helpful:

We have a fairly small, private organization of approx 250 members that uses bbPress forums (we do not use BuddyPress)
ALL 'New Topics' are emailed to ALL of our members.
No 'Replies' will be emailed to any member, unless they choose to "subscribe" to the topic.

All of that works with Mandrill
Some of it works with SparkPost ---- but SparkPost will not work for the "subscribe" portion - our 'reply' notifications do not go out.

Our setup:
SparkPost 2.2.1
WordPress 4.4.2 (and will be switching to WP4.5 as soon as our test site clears it for us)
bbPress 2.5.8 (topic subscription emails go through bbPress)
bbpnns 1.10 (https://wordpress.org/plugins/bbpress-notify-nospam/ --- this is how we 'force' all NewTopic notifications -- and this is working with SparkPost -- these notification emails go a different 'route' than the subscription emails)

Our site does use other plugins too, but I THINK these are the only relevant ones here.

To reiterate:
IF I "downgrade" bbPress --- and go back to using bbPress2.5.3 ---- THEN SparkPost DOES WORK --- for ALL of it - "subscriptions for reply notifications" also!

While it might seem logical to conclude that there is something 'wrong' with bbPress2.5.8 . . . .

my confusion continues because
. . . Mandrill works with bbPress2.5.3 and also with bbPress2.5.8
SparkPost works with bbPress2.5.3 but does NOT work with bbPress2.5.8

Please let me know what I can do to help. I would really like to get this working!
Thank you so much!

Chris

@cfk4spk
Copy link
Author

cfk4spk commented Apr 14, 2016

addendum:
Please note: our 'forced' email notifications that go through bbpnns DO go through SparkPost for email service and they work fine.
When I wrote that they 'go a different route' I meant that they do not involve bbPress code for sending emails.

@MichaelPereiraUK
Copy link

@cfk4spk - I went ahead and downloaded 2.5.8 to look for a similar mailer implementation which is causing the issue with BuddyPress emails not sending and it seems not to be the case.

I'm guessing it's related to #23 which is what rajumsys is referring to as why SMTP should work.

Have you tried switching to SMTP and testing that sends before looking to see if the subscription emails send? Since the API key needs different permissions in that scenario.

@MichaelPereiraUK
Copy link

For any developers coming here, you could likely create a temporary solution for the HTTP mailer by manipulating the filters available towards the end of the subscription email function.

// Custom headers
$headers  = apply_filters( 'bbp_subscription_mail_headers', $headers  );
$to_email = apply_filters( 'bbp_subscription_to_email',     $no_reply );

do_action( 'bbp_pre_notify_subscribers', $reply_id, $topic_id, $user_ids );

// Send notification email
wp_mail( $to_email, $subject, $message, $headers );

do_action( 'bbp_post_notify_subscribers', $reply_id, $topic_id, $user_ids );

return true;

ref: \bbpress\includes\common\functions.php L:1161

@cfk4spk
Copy link
Author

cfk4spk commented Apr 14, 2016

Hi MichaelPereiraUK
I may be doing something wrong - for SMTP . . I believe I have the permissions set to use it - in the API key settings, and my tests in the plugin settings page say 'successful' -- but no emails get through, and nothing shows up on SparkPost dashboard. I will try again in the morning.

As to the temporary solution you suggest -- I don't think I'm good enough at PHP to manipulate the filters.

If there's any chance that you might want to send me any hints about just how I might play around with it, I'd appreciate any insight.

Presently, it is very late here, and I need to grab a couple hours of sleep - but I will be back to this as early as possible in our AM.
THANK YOU for your help!

Chris

@rajumsys
Copy link
Contributor

I'm guessing it's related to #23 which is what rajumsys is referring to as why SMTP should work.

@MichaelPereiraUK yes, exactly that's the reason I found. bbpress sends to noreply and puts everyone else in BCC. But HTTP mailer doesn't have BCC support yet.

@cfk4spk
Copy link
Author

cfk4spk commented Apr 14, 2016

@MichaelPereiraUK yes, exactly that's the reason I found. bbpress sends to noreply and puts everyone else in BCC. But HTTP mailer doesn't have BCC support yet.

Thanks rajumsys
Do you know if this is something that might be changed in the future? (by any chance - in the 'near' future)? :-)
Meanwhile, I'll keep trying to figure out a way to use the filters.
I can leave bbPress253 in place for now -- but I don't suppose I can do that 'forever'
Thanks

@MichaelPereiraUK
Copy link

@cfk4spk - Just re-looked at the snippet I put through earlier. Clearly hadn't had my coffee ☕

It's not going to work as you'll be able to get the $headers variable which has all the contacts you need but you won't be able to mail out as you won't have the $message.

What you could probably do however which fixes the whole BCC thing temporarily is hook onto the wp_mail filter.

/**
* Filter the wp_mail() arguments.
*
* @since 2.2.0
*
* @param array $args A compacted array of wp_mail() arguments, including the "to" email,
*                    subject, message, headers, and attachments values.
*/
$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );

Since at this point you have all the details you'll need so you can just check the headers value for BCC contacts and strip them out into an array for the to value.

Again, this is just speculation and I can't say I'm too confident that it'll work out as described.

@cfk4spk
Copy link
Author

cfk4spk commented Apr 15, 2016

Thanks Michael -
I will see if I can manage to get it to work!
Even a temporary fix is a good thing - sometimes! :-)

@cfk4spk
Copy link
Author

cfk4spk commented Apr 16, 2016

Update - maybe this will help others too . . . (?)
There is a WordPress plugin available . . . and it WORKS to fix the bcc issue between SparkPost and bbPress. I'm not sure if it can be used to help the BuddyPress issue, but it may be worth a try ?
AsynCRONous bbPress Subscriptions
https://wordpress.org/plugins/asyncronous-bbpress-subscriptions/

@rajumsys
Copy link
Contributor

Just wanted to follow up if anyone else is still facing any issues regarding bcc (in bbpress) or sending with buddypress. Recently I've provided a solution to buddypress problem in #32.

I'm closing this ticket for now but please feel free to re-open if necessary.

maxharrisnet pushed a commit that referenced this issue Sep 17, 2020
maxharrisnet pushed a commit that referenced this issue Sep 17, 2020
maxharrisnet pushed a commit that referenced this issue Sep 17, 2020
Merge pull request #31 from wpcomvip/develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants