Search code examples
phpwordpressemailbuddypress

Buddypress change sender from notification mail


Buddypress is sending a notification mail ( for example when i receive a private message ).

The sender is Root User and the email address is root@localhost.

is there a way to overwrite the sender name and its email adress without make some changes in a core file?

if found this but its not working for me

add_action( 'bp_email', function( $email_type, $email_obj ) {
 $email_obj->set_from( "Greensheet@localhost", "Greensheet" );
}, 10, 2 );

Wordpress 4.5.2 Buddypress 2.5.2

regards


Solution

  • Try this filter add_filter( 'wp_mail_from', 'my_mail_from' );

    function my_mail_from( $email )
    {
        return "noreply@yourdomain.com";
    }
    

    Add this code in your functions.php or create your site plugin