Very strange BP Emails behaviour
-
I’m using Sendgrid plugin to send emails. It replaces the
wp_mail()function included with WordPress. Also BuddyPress 2.5.2 and WordPress 4.4.2.In the BuddyPress source code I found a filter
'bp_email_use_wp_mail', which skips BP’s email handling and instead sends everything towp_mail()ifwp_mail_content_type()has been configured for HTML, or ifwp_mail()has been redeclared. That’s exactly my case (bothif‘s).So to omit using
wp_mail()– which sends data in plain text only – I wrote this:function cd_fix_bp_email_for_sendgrid( $status ) { return false; } add_filter( 'bp_email_use_wp_mail', 'cd_fix_bp_email_for_sendgrid' );And now I’m using BuddyPress sending functionality. And not receiving emails at all.
I opened
bp_send_email()function and printed debug information right before this line:do_action( 'bp_send_email_success', $status, $email );I see that
$statusistrue,$email– is not good (content_html == content_plaintext).I opened
class-bp-phpmailer.php(which actually sends all the data) and printed the$phpmailerobject right beforereturn $phpmailer->Send();call – everything is fine (template populated, content processed properly) – but no email in my inbox.So to sum up:
- Sendgrid redefines
wp_mail(), I filtered this to usebp_email() $phpmailerhas proper content- email is not sent
Dunno what to do next to start using these cool new BuddyPress Emails 🙂
- Sendgrid redefines
- You must be logged in to reply to this topic.