• Re: iThemes Security > Settings > Notification Center > From Email

    Hi there,

    We’d like to change the email address NAME from which we are receiving email notifications.

    Click here: http://prntscr.com/nxijh6

    We already changed the input field to security@mydomainname.com; however, when we get an email notification, it says from “WordPress <security@mydomainname.com>

    We’d like to change the “WordPress” field to something like “iThemes Security”

    How can we do this without altering or affecting any other default forms (i.e., gravity forms) used by our website? Can we change this somewhere in the plugin’s php file or can you provide a snippet to do this?

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The WordPress core filter wp_mail_from_name does the job.

    The trick is to hook into this filter for emails send by the iTSec plugin only.

    Thread Starter jetxpert

    (@jetxpert)

    Hi @nlpro ,

    Thank you. We meet again 🙂

    Any ideas on how we can do this with a snippet? (click below. closing the loop)

    https://wordpress.org/support/topic/add-back-custom-notification-email-address/

    And quite honestly, not sure why iThemes doesn’t give us the option to change these fields within the plugin. Would be nice.

    Cheers!

    In the (7.4.0) better-wp-security/core/lib/class-itsec-mail.php file replace line 608:

    $headers[] = "From: <{$from}>";

    with:

    $headers[] = "From: iThemesSecurity<{$from}>";

    Untested 😉

    Or a little bit more complicated (but also more creative and flexible).

    Add the following lines after line 610 in the (7.4.0) better-wp-security/core/lib/class-itsec-mail.php file:

    /**
     * Filter the $headers parameter passed to wp_mail().
     *
     * @param array $headers
     * @param string $from
     */
    $headers = apply_filters( 'itsec_email_headers', $headers, $from );

    Then in the active theme functions.php file add the lines below:

    add_filter( 'itsec_email_headers', 'itsec_email_headers_cb', 10, 2 );
    
    function itsec_email_headers_cb( $headers, $from ) {
    	if ( $from ) {
    		$headers[1] = "From: iThemesSecurity<{$from}>";
    	}
    
    	return $headers;
    }

    Again untested. Also do note changes to the iTSec plugin code will be undone when updating the plugin …

    Thread Starter jetxpert

    (@jetxpert)

    @nlpro ,

    As always, appreciate very much your inputs. You should work for iThemes and get paid for all the work you put into this. Hard to believe they almost never answer questions posted in this plugin support forum.

    Your “fix” above, while not tested, makes sense. iThemes needs to update their plugin (standard and/or pro) to include in the Notification Center settings the ability to use either the default WP “mail from” setting or a custom “mail from” setting.

    We won’t be testing your code since we know it will change at next plugin revision. A permanent solution would be nice (not from you rather iThemes).

    Cheers!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Notification Center (Change Email Address)’ is closed to new replies.