WordPress Snippets at WPcustoms

Change default FROM email address

WordPress uses [email protected] as its default FROM email if an automated email has been fired. You can change these email header settings with these two little filters.

/**
 * Snippet Name: Change default FROM email address
 * Snippet URL: https://www.wpcustoms.net/snippets/change-default-from-email-address/
 */
   
function new_mail_from($old) {
 return '[email protected]';
}
 
function new_mail_from_name($old) {
 return 'John Doe';
}
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');