How to assign a 'From' sender for the confirmation email

Running SbE plugin on a mutlisite. When user subscribes to a blog, the subscription confirmation email is sent with an empty 'From' field <> and displays in the recipient's mailbox as an 'unknown sender'. How can this sender email be set? There's no field for this in the plugin's Settings area.

  • Michael Bissett

    Hey @HB, Michael here!

    The "From" email should be using the address mentioned in the "Notification From Email" field inside of:

    Subscriptions -> Settings -> General Settings

    Would you happen to have a SMTP plugin set up on your site, or another plugin that would change the email address like this?

    If you're not sure if you do, I'd advise doing a conflict test, to help weed out the culprit here. We've got our handy troubleshooting flowchart available, it's down at the bottom of our Getting Support page:

    https://premium.wpmudev.org/manuals/getting-support/

    Also, just in case I need to take a further look at things, could you also enable Support Access to your site, as we lay out in the guide below:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Kind Regards,
    Michael

  • HB

    Thanks, Michael. The "Notification From Email" is not present in the UI on my General Settings tab. (see screenshot)

    There's no SMTP plugin set up (the server just uses local smtp to relay) and the only other plugins in use on this site are: Aesop Story Engine, GA by Yoast, Password Protected, Simple Buttons Share Adder.

    Any ideas why the Notification From Email field is missing? This is a site within a mutlisite but that shouldn't matter, correct?

  • Michael Bissett

    Hey @HB,

    My apologies, for Multisite, you'll want to go inside your Network Dashboard, and navigate to:

    Settings -> Subscribe By Email

    Is there an email noted in the "Notification From Email" field there? If not, you'll want to enter one in there.

    (e.g. no-reply@yourdomain.com)

    Now, this will specify a no-reply address that's for your network domain. If you're wanting to allow each subsite to have it's own no-reply address (a no-reply address is recommended, for the sake of spam filters), you can insert this code into your site as a mu-plugin:

    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' );

    To do this, go to your /wp-content/ folder via FTP, and find the folder called "mu-plugins". If there is no folder with that name, then you'll want to create one. Then, create a file inside that folder, and give the file any name you like and paste the code in there.

    You don't need to activate that plugin, as it will be always be automatically activated. Please be sure to add a PHP start tag at the beginning of the code if you insert this code as a mu-plugin, like this:

    <?php

    Let me know if this helps please! :slight_smile:

    Kind Regards,
    Michael

    P.S. Code credit due:

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

  • HB

    Hi Michael,
    Tried this approach and it was an improvement but not quite the desired result.

    Previously the confirmation emails and post notification emails were sent From: Unknown sender. This approach changed them to From: no-reply@main-multisite-domain. We need the emails to come from the mapped domain specific to the subsite, From: no-reply@mapped-domain-for-subsite. Does that make sense? How would this be possible?

    Also, is there a way to achieve this without having Subcriptions by Email plugin activated at the Network level? Understood your directions to require the plugin activation at the multisite network level.

    Thanks.

  • Michael Bissett

    Hey @HB,

    ...is there a way to achieve this without having Subcriptions by Email plugin activated at the Network level? Understood your directions to require the plugin activation at the multisite network level.

    The mu-plugin method I mentioned can work whether Subscribe by Email is activated site-by-site, or network activated.

    However, when you say:

    Tried this approach and it was an improvement but not quite the desired result.

    Are you referring to changing the setting I mentioned, or the mu-plugin method? If the former, could you try implementing the mu-plugin method I suggested, and seeing if that helps?

    If you did implement the mu-plugin method though, and the results you mentioned earlier were related to that, then I'll want to have a deeper look at what's going on here. Could you please send in the following via our secure contact form:

    - Mark to my attention, the subject line should contain only: ATTN: Michael Bissett
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include WordPress network admin access details (login address, username & password)
    - Include FTP log-in details (hostname, username & password)
    - Include the name of the domain mapped subsite you tested with here (and where I can find it on your network)
    - Include any relevant URLs for your site

    On the contact form (linked to below), please select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.