Skip to content

Instantly share code, notes, and snippets.

@adrian7
Created August 24, 2012 19:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adrian7/3454592 to your computer and use it in GitHub Desktop.
Save adrian7/3454592 to your computer and use it in GitHub Desktop.
Changes WP default From: Wordpress <wordpress@yourdomain.tld> emails header
/**
* Changes WP default From: Wordpress <wordpress@yourdomain.tld> emails header
* to From: Blogname <no-reply@yourdomain.tld>. 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