Posted By

chrisaiv on 09/18/14


Tagged

wordpress


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tryan326


Wordpress: Change admin email to new users (example 2)


 / Published in: JavaScript
 

URL: http://premium.wpmudev.org/blog/wordpress-email-settings/

This is similar to example 1 but more portable.

  1. /** ******** ******** ******** ******** ******** ******** ******** ********
  2. * TITLE: Change admin e-mail to new users
  3. * DESCRIPTION: auto-detect the server so you only have to enter the front/from half of the email address, including the @ sign
  4. *
  5. * http://snipplr.com/view/77687/wordpress-change-admin-email-to-new-users/
  6. * http://miloguide.com/filter-hooks/wp_mail_from_name/
  7. * http://premium.wpmudev.org/blog/wordpress-email-settings/
  8. *
  9. */
  10. function admin_email_filter_wp_mail_from($email){
  11. /* start of code lifted from wordpress core, at http://svn.automattic.com/wordpress/tags/3.4/wp-includes/pluggable.php */
  12. $sitename = strtolower( $_SERVER['SERVER_NAME'] );
  13. if ( substr( $sitename, 0, 4 ) == 'www.' ) {
  14. $sitename = substr( $sitename, 4 );
  15. }
  16. /* end of code lifted from wordpress core */
  17. $myfront = "[email protected]";
  18. $myback = $sitename;
  19. $myfrom = $myfront . $myback;
  20. return $myfrom;
  21. }
  22. add_filter("wp_mail_from", "admin_email_filter_wp_mail_from");

Report this snippet  

You need to login to post a comment.