Last active
August 29, 2015 14:14
-
-
Save mauriciogofas/7cfc8e03aaf107d75e36 to your computer and use it in GitHub Desktop.
Default WP From email
This file contains 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
<?php | |
//Default From mail | |
function custom_wp_mail_from( $email ) { | |
$handle = 'site'; | |
$find = 'http://www.'; | |
$replace = ''; | |
$link = get_bloginfo( 'url' ); | |
$domain = str_replace( $find, $replace, $link ); | |
return $handle . '@' . $domain ; | |
} | |
add_filter( 'wp_mail_from', 'custom_wp_mail_from' ); | |
class email_return_path { | |
function __construct() { | |
add_action( 'phpmailer_init', array( $this, 'fix' ) ); | |
} | |
function fix( $phpmailer ) { | |
$phpmailer->Sender = $phpmailer->From; | |
} | |
} | |
new email_return_path(); | |
//From name | |
add_filter('wp_mail_from_name', 'new_mail_from_name'); | |
function new_mail_from_name($old) { | |
$site_name = get_option( 'blogname'); | |
return $site_name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment