How can I change the sender email address?

Hi,

How can I change the sender email address?

Thanks!

  • Tyler Postle
    • CGO

    Hey Arom,

    Hope you're doing well today!

    If you have it network activated then you can change the sender email via:

    Network admin > Settings > Subscribe by email

    If you don't then you can use a function such as this one here:

    function sbe_hooks_set_from_email( $from_email ) {
    		$home_url = home_url();
    		$home_url = preg_replace( '/^http:\/\//i', '', $home_url );
    		return 'no-reply@' . $home_url;
    }
    add_filter( 'incsub_sbe_from_email', 'sbe_hooks_set_from_email' );

    Add that as an mu-plugin.

    From this post: https://premium.wpmudev.org/forums/topic/mails-sent-from-the-subsite-not-from-the-mapped-domain#post-811699

    That will give you no-reply@{subsitedomain}.com

    I'm realizing you were actually the one in that thread as well :smiley: is that solution not working for you anymore?

    Cheers,
    Tyler

  • Arom77
    • Froggy

    Hey tyler Postle :slight_smile:

    Subscribe by email is not network activated.

    I see that for every subsite sender address is <no-reply@meilleursfranchiseurs.creersonsite.net>
    (meilleursfranchiseurs.creersonsite.net was a subsite this plugin was activated on)

    I don't know why, I guess I made some changes long time ago but can't remember.

    What can I do?

    Thanks!

  • Sajid
    • DEV MAN’s Sidekick

    Hi Arom77,
    Hope you are doing good today :slight_smile:

    The code posted above by Tyler should replace the http from URL and set the from email address as no-reply@yourdomain.com. If you have this code in an mu-plugin or available for all sites on your network with sudomain setup that it should add the url like no-reply@subdomain.yourdomain.com.

    Yes, its might be the case here, you made changes and added the above code, that exactly does what you are describing. In this case you need to find that code and change the way its set the from email address.

    You can do a directory search by this key word:
    incsub_sbe_from_email

    Take care and have a nice day :slight_smile:

    Kind Regards,
    Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.