Skip to content

Instantly share code, notes, and snippets.

@pietromalerba
Forked from adrian7/wpmailbranding.php
Created September 18, 2013 12:55
Show Gist options
  • Save pietromalerba/6608770 to your computer and use it in GitHub Desktop.
Save pietromalerba/6608770 to your computer and use it in GitHub Desktop.
/**
* Changes WP default From: Wordpress <[email protected]> emails header
* to From: Blogname <[email protected]>. Customizable, drop it in your theme's functions.php to take effect.
* @author Adrian7 (http://adrian.silimon.eu)
*/
function wp_mail_branding($args){
$wp_domain = @parse_url(get_bloginfo('url'));
$wp_domain = $wp_domain['host'];
$wp_blogname = get_bloginfo('name');
//will not touch any existing headers
if ( empty($args['headers']) ) $args['headers'] = "From: {$wp_blogname} <no-reply@{$wp_domain}>";
return $args;
}
add_filter('wp_mail', 'wp_mail_branding', 99, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment