Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change “reply-to” email in buddypress activation email??


  • rafiquej
    Participant

    @rafiquej

    Hi there,

    I would like to change “Reply-to” email address and use “noreply@example.com” in buddypress activation email.

    However i am using a plugin “WP Mail From II” to change the default email to “noreply@example.com”. It worked like a charm! but i noticed that it didn’t changed “reply-to” email address and the user can reply to the admin email. I would like to change that email to noreply@example.com as well.

Viewing 11 replies - 1 through 11 (of 11 total)

  • rafiquej
    Participant

    @rafiquej

    Anyone????


    danbp
    Moderator

    @danbp

    Deactivate the mail plugin and add this snippet into your (child)theme functions.php file and give a try:

    add_filter('wp_mail_from','custom_email_from');
    function custom_email_from( $mail ) {
    	$mail = 'noreply@example.com'; // Replace the email address here //
    	return $mail;
    }

    r-a-y
    Keymaster

    @r-a-y

    I commented on this behavior in this ticket comment:
    https://buddypress.trac.wordpress.org/ticket/7051#comment:3

    BuddyPress sets the Reply-To email header to the admin email’s address by default.

    To override this, you have to use the 'bp_email_set_reply_to' filter since 'wp_mail_from' only handles the From email address header and not Reply-To header.

    The following would work:

    add_filter( 'bp_email_set_reply_to', function( $retval ) {
        return new BP_Email_Recipient( 'noreply@example.com' );
    } );

    rafiquej
    Participant

    @rafiquej

    Thanks for your replies 🙂


    @danbp
    your solution only changed From email address. But i want to change Reply-to email address to noreply@example.com


    @r-a-y
    I placed your code in functions.php but when i tried to register, i am getting this error.

    Fatal error: Call to a member function get_address() on string in /public_html/wp-content/plugins/buddypress/bp-core/classes/class-bp-phpmailer.php on line 94

    It only appears when i use this code, or else it works fine. That’s weird :/


    rafiquej
    Participant

    @rafiquej

    P.S I added it to class-bp-email.php, it gives the same error! Recheck to code again, maybe you missed something or their is an error in the code 😀 @r-a-y or maybe i am adding the code in the wrong file, if yes then guide me where to add it 🙂


    r-a-y
    Keymaster

    @r-a-y

    Try the updated code snippet in my previous post.


    rafiquej
    Participant

    @rafiquej

    It WORKED! Thanks a lot @r-a-y. I really appreciate your help. 🙂

    Cheers 😉


    melhergui
    Participant

    @melhergui

    Hi everyone!

    I couldn’t make it work, it is always sending with the admin email. Can anyone help me with this issue?

    Here is the codes i tried:

    
    add_filter( 'bp_email_set_from', function( $retval ) {
        $user = wp_get_current_user();
        return new BP_Email_Recipient( $user->data->user_email );
    }, 99, 1 );
    
    add_filter( 'bp_email_set_reply_to', function( $retval ) {
        $user = wp_get_current_user();
        return new BP_Email_Recipient( $user->data->user_email );
    }, 99, 1 );
    
    add_action( 'bp_email', function( $email_type, $email_obj ) {
        $user = wp_get_current_user();
        $email_obj->set_from( $user->data->user_email , "Custom Website Name" );
    }, 99, 2 );
    

    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    Use this one to change from email.

    add_filter('wp_mail_from','custom_email_from');
    function custom_email_from( $mail ) {
    	$mail = 'noreply@example.com'; // Replace the email address here //
    	return $mail;
    }

    Thanks


    melhergui
    Participant

    @melhergui

    Hi @prashantvatsh and everyone,

    The problem was that i am using Easy WP SMTP and it overwrites the reply to header.
    Sorry to ask without knowing this, but i hope it helps others anyway.

    Thanks for your help!


    Prashant Singh
    Participant

    @prashantvatsh

    Great 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Skip to toolbar