Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress 4.6 - Fatal Error: Uncaught phpmailerException #123

evansvince opened this issue Aug 25, 2016 · 5 comments

WordPress 4.6 - Fatal Error: Uncaught phpmailerException #123

evansvince opened this issue Aug 25, 2016 · 5 comments


Copy link

@evansvince evansvince commented Aug 25, 2016

The latest version of Wordpress (4.6) and Valet causes a fatal error on step 2 of installing wordpress. The error is "Fatal error: Uncaught phpmailerException: Invalid address: wordpress@....".

This error occurs because WP expects the $_SERVER['SERVER_NAME'] to be set in order to create the $from_email variable. See wp-includes/pluggable.php ~line 326.

By default, Valet does not set the $_SERVER['SERVER_NAME']. Run phpinfo() and you will see no value.

To fix this issue:

In ~/.composer/vendor/laravel/valet/clu/drivers/WordPressValetDriver.php, within the frontControllerPath, add the following:

$_SERVER['SERVER_NAME'] = $siteName.'.dev'

That's assuming you are using the .dev TLD. If not, change it to whatever you are using.

Run valet restart.

Copy link

@jastuccio jastuccio commented Sep 1, 2016

This fixed my problem. Here is the function, including the new line.

     * Get the fully resolved path to the application's front controller.
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return string
    public function frontControllerPath($sitePath, $siteName, $uri)
        $_SERVER['PHP_SELF']    = $uri;
        $_SERVER['SERVER_ADDR'] = '';
        $_SERVER['SERVER_NAME'] = $siteName.'.dev';

        return parent::frontControllerPath(
            $sitePath, $siteName, $this->forceTrailingSlash($uri)
Copy link

@victorhguillen victorhguillen commented Sep 7, 2016

Perfect it works. Thanks.

Copy link

@robertbiswas robertbiswas commented Sep 11, 2016

Yeah. It works for me too! Thank you.

Copy link

@adamwathan adamwathan commented Sep 24, 2016

Fixed in 353f24c

@adamwathan adamwathan closed this Sep 24, 2016
Copy link

@ghost ghost commented Nov 11, 2016

Super helpful. Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.