Skip to main content
All CollectionsMainWP Customization
How to change the FROM address for MainWP emails
How to change the FROM address for MainWP emails
Updated over a month ago

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; }
Did this answer your question?