{"record":{"id":"00faff0086e5f6d4","repo":"ellite/Wallos","slug":"this-lang-recipients-failed-errstr","errorCode":null,"errorMessage":"$this->lang('recipients_failed') . $errstr","messagePattern":"\\$this->lang\\('recipients_failed'\\) \\. \\$errstr","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/PHPMailer/PHPMailer.php","lineNumber":2086,"sourceCode":"            $this->doCallback(\n                $cb['issent'],\n                [[$cb['to'], $cb['name']]],\n                [],\n                [],\n                $this->Subject,\n                $body,\n                $this->From,\n                ['smtp_transaction_id' => $smtp_transaction_id]\n            );\n        }\n\n        //Create error message for any bad addresses\n        if (count($bad_rcpt) > 0) {\n            $errstr = '';\n            foreach ($bad_rcpt as $bad) {\n                $errstr .= $bad['to'] . ': ' . $bad['error'];\n            }\n            throw new Exception($this->lang('recipients_failed') . $errstr, self::STOP_CONTINUE);\n        }\n\n        return true;\n    }\n\n    /**\n     * Initiate a connection to an SMTP server.\n     * Returns false if the operation failed.\n     *\n     * @param array $options An array of options compatible with stream_context_create()\n     *\n     * @throws Exception\n     *\n     * @uses \\PHPMailer\\PHPMailer\\SMTP\n     *\n     * @return bool\n     */\n    public function smtpConnect($options = null)","sourceCodeStart":2068,"sourceCodeEnd":2104,"githubUrl":"https://github.com/ellite/Wallos/blob/52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd/libs/PHPMailer/PHPMailer.php#L2068-L2104","documentation":"Thrown in smtpSend() after the DATA phase when one or more recipients were rejected by the server (collected in $bad_rcpt with their per-recipient SMTP errors). The exception message concatenates the localized 'recipients_failed' string with 'address: error' pairs. Unlike other SMTP errors this is STOP_CONTINUE, so per-recipient failures can still allow partial delivery to accepted recipients before the exception surfaces.","triggerScenarios":"Calling send() over SMTP when $this->smtp->recipient() returns false for any address during the RCPT TO loop: invalid/nonexistent recipient (550), relay denied (554), recipient over quota, or server rejecting due to rate/policy limits.","commonSituations":"Typo'd or bounce-hardened recipient addresses, sending to addresses that no longer exist, relaying denied for external recipients on an internal relay, distribution lists blocking external senders, per-recipient spam policies.","solutions":["Read $mailer->ErrorInfo / the exception message: it lists each failed address with the server's error code.","Validate recipient addresses before sending (filter_var($email, FILTER_VALIDATE_EMAIL), or verify the mailbox exists).","Remove or correct rejected addresses from the recipient list and retry for the remaining recipients.","If relay is denied (554/550 relay access denied), authenticate properly or use the correct relay host for external recipients.","Check for typos and stale addresses in your mailing list source (hard bounces)."],"exampleFix":"// before\n$mailer->addAddress('user@gmial.com'); // typo: rejected 550\n$mailer->send();\n// after\n$rcpt = 'user@gmail.com';\nif (filter_var($rcpt, FILTER_VALIDATE_EMAIL)) {\n    $mailer->addAddress($rcpt);\n}\n$mailer->send();","handlingStrategy":"validation","validationCode":"foreach ($recipients as $rcpt) {\n    if (!filter_var($rcpt, FILTER_VALIDATE_EMAIL)) {\n        throw new InvalidArgumentException(\"Invalid recipient: {$rcpt}\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    $mailer->send();\n} catch (PHPMailer\\PHPMailer\\Exception $e) {\n    if (str_contains($mailer->ErrorInfo, 'recipients_failed')) {\n        error_log('Bad recipients: ' . $mailer->ErrorInfo); // lists address: error pairs\n        // prune failed addresses from list and requeue remaining\n    }\n}","preventionTips":["Validate every recipient with FILTER_VALIDATE_EMAIL before addAddress().","Scrub hard-bounced addresses from mailing lists regularly.","Authenticate against the correct relay so external RCPT isn't relay-denied.","Parse the exception message to recover per-recipient error codes."],"tags":["php","phpmailer","smtp","recipients","email-delivery"],"backgroundTag":"resource-not-found","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"}