Fix for BuddyPress e-mail notifications problem
| SHARE: | Share |
|
I have a client who installed BudyPress and since then the mail() function stopped working. SMTP could not connect neither. I had to look into BudyPress’ code to find the problem.
Here is a fast fix for this issue:
- Open up wp-content/plugins/buddypress/bp-core/bp-core-filters.php (back up everything you edit, you can never know..)
- Go to line 29, you should see this code:
return apply_filters( 'bp_core_email_from_address_filter', __( 'noreply', 'buddypress' ) . '@' . $domain[2] ); - A fast fix is this:
return apply_filters( 'bp_core_email_from_address_filter', __( 'noreply', 'buddypress' ) . '@yoursite.com' );
Replace yoursite.com with your site’s URL.
It should work now.
Was this post useful? Buy me a beer!
Note: I wanted to post this fix on their site but could not find a place where to create a new account. I suppose registration is disabled.
Incoming search terms:
- buddypress email notifications (41)
- buddypress email (38)
- buddypress registration not working (24)
- buddypress email notification (17)
- buddypress email notifications not working (10)
- buddypress noreply (9)
- buddypress emails (8)
- powered by SMF star graphics (6)
- buddypress smtp (6)
- buddypress registration email (5)
Filed under: Web development · Tags: BuddyPress, BuddyPress e-mail notifications, Buddypress mail(), Buddypress Private Messaging, Buddypress SMTP, e-mail notifications, Email notification not working
it worked! You’re the man man. You are tH-E M-A-N.
Great! I am glad that my post was helpful.
This is a great fix and it solved the problem in my BP site, but I have one question – I added my domain as above, but in the notification email that the user gets the address shows up with my username on my web host in the spot before the @domain. Is there any way to set that to something else. I really don’t want that to be public. I tried adding admin before the @ in the PHP, but that didn’t work. Thanks!
Try this..
Find and replace the code from step 3 with this one:
return apply_filters( 'test@yoursite.com' );Unfortunately I do not have a BP installed to test it, but it should work.
Thanks for the quick response, but it doesn’t work – I get a warning “Missing argument 2 for apply_filters()…”
I solved the address problem with the Mail From plug-in – thanks again for the fix!
Great! You are welcome.
Joseph your a genius!
Thank you so much for posting this fix. I’ve been loosing my mind, and my weekend, over this problem. Thank you! Thank You!
I changed it, but I still don’t receive new E-mail notifications
Otaku, I don’t know what to say. If you made the changes as suggested, it should be OK. If you still can’t fix it contact me and I’ll try to fix it for you.
I echo Jeff’s sentiments exactly. Thanks a million!
So glad I found this. I just installed BP and have tried several solutions offered on BP forum and other websites, but this is the only one that worked. Thank you!!!
you are greate
This was a great fix! Thanks so much — this was a major problem for me!
Great tutorial, thanks. Although I haven’t much use of it. I just needed a solution to disable the bp_core_email_from_name_filter() since I use wp-email-smtp and contact7 plugins which puts the senders name and email in the from field.
I commented out the rows 2 – 32 and that does the trick.
Here are the lines I’ve commented out:
/**
* bp_core_email_from_name_filter()
*
* Sets the “From” name in emails sent to the name of the site and not “WordPress”
*
* @package BuddyPress Core
* @uses get_blog_option() fetches the value for a meta_key in the wp_X_options table
* @return The blog name for the root blog
*/
function bp_core_email_from_name_filter() {
return apply_filters( ‘bp_core_email_from_name_filter’, wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, ‘blogname’ ), ENT_QUOTES ) );
}
add_filter( ‘wp_mail_from_name’, ‘bp_core_email_from_name_filter’ );
/**
* bp_core_email_from_name_filter()
*
* Sets the “From” address in emails sent
*
* @package BuddyPress Core
* @global $current_site Object containing current site metadata
* @return noreply@sitedomain email address
*/
function bp_core_email_from_address_filter() {
$domain = (array) explode( ‘/’, site_url() );
return apply_filters( ‘bp_core_email_from_address_filter’, __( ‘noreply’, ‘buddypress’ ) . ‘@’ . $domain[2] );
}
add_filter( ‘wp_mail_from’, ‘bp_core_email_from_address_filter’ );