Blog
iWeb Open Source
Change WordPress email sender
January 17, 2012 | Phil
Email sent using the wp_mail function has its sender name and email address set to fairly useless default values.
We give WordPress our site name and an email address in the settings screen of WordPress, wouldn’t it be better to have email sent using these details?
We can get the relevant details using get_bloginfo('name') and get_bloginfo('admin_email').
Add these snippets to your functionality plugin or functions.php:
/**
* Change wp_mail from name
*/
function change_from_name($name = '') {
return get_bloginfo('name');
}
add_filter('wp_mail_from_name', 'change_from_name');
/**
* Change wp_mail from email
*/
function change_from_email($email = '') {
return get_bloginfo('admin_email');
}
add_filter('wp_mail_from', 'change_from_email');
Remember we’re WordPress and Magento experts, get in touch if you’re looking for Ecommerce Web Development.