How to Change wp_mail From Address in WordPress

WordPress comes bundled with a hook called wp_mail_from which allows you to change from email address. All you have to do is add the following code to your functions.php file.

See Also: How to Open WordPress Menu Link in New Window / Tab?

add_filter('wp_mail_from','custom_wp_mail_from');
function custom_wp_mail_from($email) {
  return 'info@xyzcompany.com';
}

You can also use wp_mail_from_name to change from name.

add_filter('wp_mail_from_name','custom_wp_mail_from_name');
function custom_wp_mail_from_name($name) {
  return 'abc';
}

 

0 Comments

Leave a Comment.