Update class.phpmailer.php update for PHP 8.1

This commit is contained in:
markjcrane 2023-06-24 16:59:20 -06:00
parent b23a18fdf1
commit 65a84216bb
1 changed files with 5 additions and 1 deletions

View File

@ -870,6 +870,8 @@ class PHPMailer
*/ */
protected function addOrEnqueueAnAddress($kind, $address, $name) protected function addOrEnqueueAnAddress($kind, $address, $name)
{ {
if (empty($address)) { $address = ''; }
if (empty($name)) { $name = ''; }
$address = trim($address); $address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
if (($pos = strrpos($address, '@')) === false) { if (($pos = strrpos($address, '@')) === false) {
@ -1010,8 +1012,10 @@ class PHPMailer
* @throws phpmailerException * @throws phpmailerException
* @return boolean * @return boolean
*/ */
public function setFrom($address, $name = '', $auto = true) public function setFrom($address, $name, $auto = true)
{ {
if (empty($address)) { $address = ''; }
if (empty($name)) { $name = ''; }
$address = trim($address); $address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
// Don't validate now addresses with IDN. Will be done in send(). // Don't validate now addresses with IDN. Will be done in send().