Wordpress: Change admin e-mail to new users
Example 1: Enter the full email address you want displayed.
/** ******** ******** ******** ******** ******** ********
* TITLE: Change admin e-mail to new users
* DESCRIPTION: enter the full email address you want displayed
*
* http://miloguide.com/filter-hooks/wp_mail_from/
*/
function email_filter_wp_mail_from($email){
return "daffy.duck@example.com";
}
add_filter("wp_mail_from", "email_filter_wp_mail_from");
Example 2: Similar to example #1 but more portable.
/** ******** ******** ******** ******** ******** ********
* TITLE: Change admin e-mail to new users
* DESCRIPTION: auto-detect the server so you only have to enter the front/from half of the email address, including the @ sign
*
* http://snipplr.com/view/77687/wordpress-change-admin-email-to-new-users/
* http://miloguide.com/filter-hooks/wp_mail_from_name/
* http://premium.wpmudev.org/blog/wordpress-email-settings/
*
*/
function admin_email_filter_wp_mail_from($email){
/* start of code lifted from wordpress core, at http://svn.automattic.com/wordpress/tags/3.4/wp-includes/pluggable.php */
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
if ( substr( $sitename, 0, 4 ) == 'www.' ) {
$sitename = substr( $sitename, 4 );
}
/* end of code lifted from wordpress core */
$myfront = "whateverIwant@";
$myback = $sitename;
$myfrom = $myfront . $myback;
return $myfrom;
}
add_filter("wp_mail_from", "admin_email_filter_wp_mail_from");