0

I'm having a weird issue with the email from name being set as @localhost when I send mails from a site. Im running on Nginx and PHP7.

Its consequently being rejected so I get a 500 on user registration.

I've tried setting the name, email address via functions.php, hardcoding the site urls in local-config, using SparkPost, turning off Cloudflare, confirming server name in nginx config and trying to do an ini_set in my local-config.

Any ideas?

0

What is the setting in your server /etc/hostname file? Based on wp_mail source code:

if ( !isset( $from_email ) ) {
    // Get the site domain and get rid of www.
    $sitename = strtolower( $_SERVER['SERVER_NAME'] );
    if ( substr( $sitename, 0, 4 ) == 'www.' ) {
        $sitename = substr( $sitename, 4 );
    }
    $from_email = 'wordpress@' . $sitename;
}

What this means is that the name localhost is pick up from /etc/hostname.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.