Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: How did spammer get usernames and emails

Discussion in 'Misc WordPress Requests' started by Ewout, Dec 3, 2017.

  1. Ewout

    Guest

    Reply To: How did spammer get usernames and emails, by Ewout

    small modification to the wp_mail_from filter to apply it only to the lost/reset password emails (the original filter broke return addresses on my contact form emails):


    add_filter( 'wp_mail_from', 'reset_password_from_email' );
    function reset_password_from_email( $from_email ) {
    if ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], array( 'lostpassword', 'retrievepassword' ) ) ) {
    // Get the site domain and get rid of www.
    $sitename = strtolower( parse_url( get_home_url( get_current_blog_id() ), PHP_URL_HOST ) );
    if ( substr( $sitename, 0, 4 ) == 'www.' ) {
    $sitename = substr( $sitename, 4 );
    }
    $from_email = '[email protected]' . $sitename;
    }
    return $from_email;
    }

    Reply To: How did spammer get usernames and emails
     
    #1

Share This Page

Web Hosting