diff --git a/src/PHPMailer.php b/src/PHPMailer.php index 7641cd66a..449261510 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -962,7 +962,10 @@ protected function addOrEnqueueAnAddress($kind, $address, $name) $pos = strrpos($address, '@'); if (false === $pos) { // At-sign is missing. - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; + $error_message = sprintf('%s (%s): %s', + $this->lang('invalid_address'), + $kind, + $address); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1010,7 +1013,9 @@ protected function addOrEnqueueAnAddress($kind, $address, $name) protected function addAnAddress($kind, $address, $name = '') { if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) { - $error_message = $this->lang('Invalid recipient kind: ') . $kind; + $error_message = sprintf('%s: %s', + $this->lang('Invalid recipient kind'), + $kind); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1020,7 +1025,10 @@ protected function addAnAddress($kind, $address, $name = '') return false; } if (!static::validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; + $error_message = sprintf('%s (%s): %s', + $this->lang('invalid_address'), + $kind, + $address); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1126,7 +1134,9 @@ public function setFrom($address, $name = '', $auto = true) if (false === $pos or (!$this->has8bitChars(substr($address, ++$pos)) or !static::idnSupported()) and !static::validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (setFrom) $address"; + $error_message = sprintf('%s (From): %s', + $this->lang('invalid_address'), + $address); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1376,7 +1386,10 @@ public function preSend() } $this->$address_kind = $this->punyencodeAddress($this->$address_kind); if (!static::validateAddress($this->$address_kind)) { - $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind; + $error_message = sprintf('%s (%s): %s', + $this->lang('invalid_address'), + $address_kind, + $this->$address_kind); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) {