WordPress 4.6 - Fatal Error: Uncaught phpmailerException #123

evansvince opened this Issue Aug 25, 2016 · 5 comments


None yet

6 participants


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.

jastuccio commented Sep 1, 2016 edited

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)
@jastuccio jastuccio added a commit to jastuccio/valet that referenced this issue Sep 2, 2016
@jastuccio jastuccio Update WordPressValetDriver.php to fix issue 123
Add $_SERVER['SERVER_NAME'] = $siteName.'.dev'

issue #123; credit goes to evansvince for providing this bugfix

Perfect it works. Thanks.


Yeah. It works for me too! Thank you.


Fixed in 353f24c

@adamwathan adamwathan closed this Sep 24, 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