Created
August 24, 2012 19:16
-
-
Save adrian7/3454592 to your computer and use it in GitHub Desktop.
Changes WP default From: Wordpress <[email protected]> emails header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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