WordPress Snippets at WPcustoms

Change default FROM email address

WordPress uses wordpress@yourdomain.com 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: http://www.wpcustoms.net/snippets/change-default-from-email-address/
 */
  
function new_mail_from($old) {
 return 'no-reply@yoursite.com';
}
 
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');