|
|
@ -38,6 +38,43 @@ class PHPMailerEnhanced extends PHPMailer {
|
|
|
|
static::splitAddressName($address, $name);
|
|
|
|
static::splitAddressName($address, $name);
|
|
|
|
return parent::setFrom($address, $name, $auto);
|
|
|
|
return parent::setFrom($address, $name, $auto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Set the Sender property
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param string $address The address
|
|
|
|
|
|
|
|
* @param string $name The name (ignored)
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return bool
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function setSender (string $address, string $name = ''): bool {
|
|
|
|
|
|
|
|
static::splitAddressName($address, $name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$address = trim((string)$address);
|
|
|
|
|
|
|
|
//Don't validate now addresses with IDN. Will be done in send().
|
|
|
|
|
|
|
|
$pos = strrpos($address, '@');
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
(false === $pos)
|
|
|
|
|
|
|
|
|| ((!$this->has8bitChars(substr($address, ++$pos)) || !static::idnSupported())
|
|
|
|
|
|
|
|
&& !static::validateAddress($address))
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
$error_message = sprintf(
|
|
|
|
|
|
|
|
'%s (From): %s',
|
|
|
|
|
|
|
|
$this->lang('invalid_address'),
|
|
|
|
|
|
|
|
$address
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->setError($error_message);
|
|
|
|
|
|
|
|
$this->edebug($error_message);
|
|
|
|
|
|
|
|
if ($this->exceptions) {
|
|
|
|
|
|
|
|
throw new Exception($error_message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->Sender = $address;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|