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.
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 …
@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!