How to change the FROM address for MainWP emails

Available with the following:

Additional Requirements:

{acf_additional_requirement}
Table of Contents

By default, MainWP will use Administration Email Address that you have saved on the WP Admin > General Settings page for most email notifications.

However, the FROM address for MainWP can be adjusted using a filter without affecting the Administration Email Address.

To do so,

  1. Install MainWP Custom Dashboard extension
  2. Navigate to your MainWP Dashboard > Extensions > Custom Dashboard
  3. Open PHP tab
  4. Add the following code snippet
    add_filter( 'mainwp_send_mail_from_header', 'myhook_mainwp_send_mail_from_header', 10, 3 );
    function myhook_mainwp_send_mail_from_header( $input, $email, $subject ) {
    	 return array(
    	 'from_name' => 'custom-from-name',
    	 'from_email' => 'custom-from-email',		 
    	 );
    }
  5. Click the Save Changes button

If you wish to change the FROM address only for specific emails that are being sent by MainWP (e.g. Daily Digest emails), you can use a variation of the above code snippet:

add_filter( 'mainwp_send_mail_from_header', 'myhook_mainwp_send_mail_from_header', 10, 3 );
function myhook_mainwp_send_mail_from_header( $input, $email, $subject ) {
	if ( 'some-email' == $email &&  'some-subject' == $subject ) {
	 return array(
	 'from_name' => 'custom-from-name',
	 'from_email' => 'custom-from-email',		 
	 ); 
	}
	return $input;
}

Still Have Questions?

Search for additional solutions in the MainWP Community or start your own discussion
MainWP Community

Table of Contents

Related Content

{acf_related_articles_1}{acf_related_articles_2}{acf_related_articles_3}{acf_related_articles_4}{acf_related_articles_5}

Ask AI Support Agent