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

No WP new user emails being sent - buddypress issue #32

Closed
SNeilson opened this Issue Apr 13, 2016 · 9 comments

Comments

Projects
None yet
6 participants
@SNeilson

SNeilson commented Apr 13, 2016

We've installed the plugin on our local dev environment, configured it using the API key on our account and we can send test in the plugin settings page.

If we try to register a new user on the site the New account email with activation link email isn't sent to the user. I get no errors on screen and it all seems like it should be working but the emails never arrive in my inbox, I've tried sending to my company account, gmail and even mailinator but nothing comes through.

  • Wordpress 4.4
  • BuddyPress 2.5.2
  • Sparkpost plugin 2.2.1
  • PHP 5.5.12

If I look in my SparkPost dashboard I see no sign of these emails being sent by the system.

We contacted your support team and was told to post here, any ideas?.

@SNeilson SNeilson closed this Apr 13, 2016

@SNeilson SNeilson reopened this Apr 13, 2016

@SNeilson SNeilson changed the title from No WP emails being sent to No WP new user emails being sent Apr 13, 2016

@MichaelPereiraUK

This comment has been minimized.

MichaelPereiraUK commented Apr 13, 2016

This seems to be an incompatibility with the way BuddyPress handles emails, and SparkPost implements it's SMTP settings.

What SparkPost does is extend the PHPMailer class and then overwrite a global $phpmailer variable with this new class.

https://github.com/SparkPost/wordpress-sparkpost/blob/master/sparkpost.class.php#L102-L109

However BuddyPress instantiates a new instance of PHPMailer when it's dealing with emails.

https://github.com/buddypress/BuddyPress/blob/master/src/bp-core/classes/class-bp-phpmailer.php#L28-L37

So it doesn't look like they're compatible at the moment.

@richleland

This comment has been minimized.

Contributor

richleland commented Apr 27, 2016

Closing as dupe of #31 - let's continue discussion there.

@richleland richleland closed this Apr 27, 2016

@MichaelPereiraUK

This comment has been minimized.

MichaelPereiraUK commented Apr 27, 2016

@richleland - BuddyPress ≠ bbPress

It seems the bbPress issue is just when using the API as it uses BCC.

This issue is that BuddyPress creates a new instance of the PHPMailer class and then does it's emails. While this plugins implementation is to grab the global $phpmailer variable and replace it with an instance of it's own class, which is simply discarded in the BuddyPress implementation.

@richleland

This comment has been minimized.

Contributor

richleland commented Apr 27, 2016

Oh I totally misread that - thanks for the clarification.

@richleland richleland reopened this Apr 27, 2016

@rajumsys

This comment has been minimized.

Member

rajumsys commented Nov 7, 2016

Given there is another report of this problem, I'll investigate this soon.

@PetervLeeuwen

This comment has been minimized.

PetervLeeuwen commented Nov 8, 2016

Oke thanks, i look forward to hear from you.

@rajumsys rajumsys changed the title from No WP new user emails being sent to No WP new user emails being sent - buddypress issue Nov 8, 2016

@rajumsys

This comment has been minimized.

Member

rajumsys commented Nov 8, 2016

So it turns out, there is a very quick & easy solution. buddypress developers already made it possible to ignore their own implementation of wp_mail and fallback to wordpress's default wp_mail (which will allow sparkpost plugin to do its magics). If you add the following snippet (functions.php of your theme or similar), it should just work.

add_filter('bp_email_use_wp_mail', function() {
  return true;
});
@PetervLeeuwen

This comment has been minimized.

PetervLeeuwen commented Nov 9, 2016

Thank you so much for investigating this for me.
This is working great!
All the email is sent over sparkpost now.

@rajumsys rajumsys closed this Nov 9, 2016

@cdaniel09

This comment has been minimized.

cdaniel09 commented Feb 7, 2018

@rajumsys This is perfect - I looked for 3 days on this solution, you are magic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment