Symptoms

A WordPress site application provisioning task fails with the following error:

Script execution failed: executing '/opt/alt/php56/usr/bin/php -d open_basedir= -q configure' for APS application instance with id 13233 returned value '255' with output '' and errors 'PHP Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: wordpress@' in /var/www/vhosts/1/140960/webspace/siteapps/WordPress-13233/htdocs/wp-includes/class-phpmailer.php:946
Stack trace:
#0 /var/www/vhosts/1/140960/webspace/siteapps/WordPress-13233/htdocs/wp-includes/pluggable.php(352): PHPMailer->setFrom('wordpress@', 'WordPress')
...

Cause

The issue is corrected in scope of request APSI-537 and fixed in Wordpress APS application version 4.6.1-235.

Resolution

Import the latest Wordpress APS version and use it for provisioning.

There are two possible workarounds in order to fixed a failed task for an older Wordpress version.

The first possible workaround is the following:

  1. Comment the following block inside /var/www/vhosts/1/<webspace_id>/webspace/siteapps/WordPress-<instance_id>/htdocs/wp-includes/class-phpmailer.php (the exact path is found in the task error message):

    public function setFrom($address, $name = '', $auto = true)
    {
        $address = trim($address);
        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
        // Don't validate now addresses with IDN. Will be done in send().
    //    if (($pos = strrpos($address, '@')) === false or
    //        (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and
    //        !$this->validateAddress($address)) {
    //        $error_message = $this->lang('invalid_address') . $address;
    //        $this->setError($error_message);
    //        $this->edebug($error_message);
    //        if ($this->exceptions) {
    //            throw new phpmailerException($error_message);
    //        }
    //        return false;
    //    }
        $this->From = $address;
        $this->FromName = $name;
        if ($auto) {
            if (empty($this->Sender)) {
                $this->Sender = $address;
            }
        }
        return true;
    }
    
  2. Re-submit the task afterwards.

As another way to resolve this issue it is possible to set a valid address for $from_email variable in /var/www/vhosts/1/<webspace_id>/webspace/siteapps/WordPress-<instance_id>/htdocs/wp-includes/pluggable.php. Then resubmit failed task.

Internal content