{"record":{"id":"174c33eef87acf17","repo":"ellite/Wallos","slug":"s-s-s","errorCode":null,"errorMessage":"%s (%s): %s","messagePattern":"%s \\(%s\\): %s","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/PHPMailer/PHPMailer.php","lineNumber":1094,"sourceCode":"    protected function addOrEnqueueAnAddress($kind, $address, $name)\n    {\n        $pos = false;\n        if ($address !== null) {\n            $address = trim($address);\n            $pos = strrpos($address, '@');\n        }\n        if (false === $pos) {\n            //At-sign is missing.\n            $error_message = sprintf(\n                '%s (%s): %s',\n                $this->lang('invalid_address'),\n                $kind,\n                $address\n            );\n            $this->setError($error_message);\n            $this->edebug($error_message);\n            if ($this->exceptions) {\n                throw new Exception($error_message);\n            }\n\n            return false;\n        }\n        if ($name !== null && is_string($name)) {\n            $name = trim(preg_replace('/[\\r\\n]+/', '', $name)); //Strip breaks and trim\n        } else {\n            $name = '';\n        }\n        $params = [$kind, $address, $name];\n        //Enqueue addresses with IDN until we know the PHPMailer::$CharSet.\n        //Domain is assumed to be whatever is after the last @ symbol in the address\n        if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) {\n            if ('Reply-To' !== $kind) {\n                if (!array_key_exists($address, $this->RecipientsQueue)) {\n                    $this->RecipientsQueue[$address] = $params;\n\n                    return true;","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/ellite/Wallos/blob/52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd/libs/PHPMailer/PHPMailer.php#L1076-L1112","documentation":"PHPMailer throws this when an address cannot be added to the queue via addOrEnqueueAnAddress (the dispatcher behind addAddress/addCC/addBCC/addReplyTo). The message is built as '%s (%s): %s' with the localized error, the recipient kind, and the address. It only throws when the $exceptions property is true; otherwise setError/edebug record it and the method returns false.","triggerScenarios":"Calling addAddress/addCC/addBCC/addReplyTo with an invalid kind or an address that fails static::validateAddress() while $mail->Exceptions (exceptions) is enabled; also when enqueued addresses later fail punyencodeAddress conversion.","commonSituations":"Passing empty strings or user-supplied input without validation, addresses containing commas or newlines from form input, internationalized addresses on PHP builds without idn_to_ascii (INTL_IDNA_VARIANT issues), or PHPMailer 6.x behavior change where addAnAddress was split into addOrEnqueueAnAddress.","solutions":["Enable exceptions properly (new PHPMailer(true)) and wrap send()/addAddress() in try-catch to see the full message","Validate the address with PHPMailer::validateAddress($email) before calling addAddress/addCC/addBCC/addReplyTo","Trim user input and reject empty strings; never pass arrays where a string is expected","Ensure the ext-intl extension is available if using IDN (unicode) addresses, or use ASCII (punycode) addresses","Check you are not passing a name into the address parameter by mistake (addAddress($addr, $name) signature)"],"exampleFix":"// before\n$mail->addAddress($userInputEmail);\n// after\nif (PHPMailer::validateAddress($userInputEmail)) {\n    $mail->addAddress(trim($userInputEmail));\n} else {\n    throw new InvalidArgumentException('Invalid recipient: ' . $userInputEmail);\n}","handlingStrategy":"try-catch","validationCode":"if (!PHPMailer::validateAddress($email)) { throw new InvalidArgumentException(\"Invalid email: $email\"); }","typeGuard":"function isEmailString(mixed $v): bool { return is_string($v) && filter_var(trim($v), FILTER_VALIDATE_EMAIL) !== false; }","tryCatchPattern":"try { $mail->addAddress($email, $name); } catch (PHPMailer\\PHPMailer\\Exception $e) { $this->logger->error('Recipient rejected: ' . $e->getMessage()); throw new InvalidRecipientException($email, $e); }","preventionTips":["Always instantiate PHPMailer(true) so errors surface as exceptions","Validate every user-supplied address before addAddress/addCC/addBCC/addReplyTo","Trim and normalize input; strip CR/LF","Check the boolean return value even with exceptions disabled"],"tags":["php","phpmailer","email","address-validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd","analyzedAt":"2026-09-13T14:09:30.873Z","contentChangedAt":"2026-09-13T14:09:30.873Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}