Last active
October 14, 2016 08:11
-
-
Save aahan/4752741 to your computer and use it in GitHub Desktop.
Different solutions that've found to replace WordPress' default admin email address and name. Should be added to your theme's functions.php file.
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 | |
/* | |
* DESCRIPTION: All WordPress email notifications are sent from | |
* [email protected] with the sender's name as "WordPress". | |
* Any one of these functions should help you change that. | |
* | |
* Relevant WordPress core file is /wp-includes/pluggable.php | |
*/ | |
// WordPress Notification Mail: Custom Sender's Email Address | |
add_filter('wp_mail_from','custom_email_from'); | |
function custom_email_from($mail) { | |
$mail = '[email protected]'; | |
return $mail; | |
} | |
// WordPress Notification Mail: Custom Sender's Name | |
add_filter('wp_mail_from_name','custom_email_from_name'); | |
function custom_email_from_name($name) { | |
// $name = get_option('blogname'); | |
$name = 'Your Name'; | |
return $name; | |
} | |
// CREDIT: http://wordpress.org/support/topic/564535#post-2083414 | |
// WordPress Notification Mail: Custom Sender's Email Address | |
add_filter('wp_mail_from','custom_email_from'); | |
function custom_email_from($mail) { | |
return '[email protected]'; | |
} | |
// WordPress Notification Mail: Custom Sender's Name | |
add_filter('wp_mail_from_name','custom_email_from_name'); | |
function custom_email_from_name($name) { | |
return 'Your Name'; | |
} | |
// CREDIT: http://wordpress.org/support/topic/564535#post-2083414 | |
// WordPress Notification Mail: Custom Settings | |
add_action('phpmailer_init', 'wp_mail_to_smtp'); | |
function wp_mail_to_smtp(&$phpmailer) { | |
$phpmailer->Sender = '[email protected]'; | |
$phpmailer->From = '[email protected]'; | |
$phpmailer->FromName = 'From Name'; | |
} | |
// CREDIT: http://www.johnparris.com/customize-wordpress-email-headers/ | |
if ( !function_exists('add_action') ) { | |
header('Status: 403 Forbidden'); | |
header('HTTP/1.1 403 Forbidden'); | |
exit(); | |
} | |
if ( !class_exists('wp_mail_from') ) { | |
class wp_mail_from { | |
function wp_mail_from() { | |
add_filter( 'wp_mail_from', array(&$this, 'fb_mail_from') ); | |
add_filter( 'wp_mail_from_name', array(&$this, 'fb_mail_from_name') ); | |
} | |
// new name | |
function fb_mail_from_name() { | |
$name = 'My Blog is my Blog'; | |
// alternative the name of the blog | |
// $name = get_option('blogname'); | |
$name = esc_attr($name); | |
return $name; | |
} | |
// new email-adress | |
function fb_mail_from() { | |
$email = '[email protected]'; | |
$email = is_email($email); | |
return $email; | |
} | |
} | |
$wp_mail_from = new wp_mail_from(); | |
} | |
// CREDIT: http://wpengineer.com/1604/change-wordpress-mail-sender/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment