{"record":{"id":"32c70b4863facbd1","repo":"ellite/Wallos","slug":"this-errorinfo","errorCode":null,"errorMessage":"$this->ErrorInfo","messagePattern":"\\$this->ErrorInfo","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"libs/PHPMailer/PHPMailer.php","lineNumber":2034,"sourceCode":"     *\n     * @return bool\n     */\n    protected function smtpSend($header, $body)\n    {\n        $header = static::stripTrailingWSP($header) . static::$LE . static::$LE;\n        $bad_rcpt = [];\n        if (!$this->smtpConnect($this->SMTPOptions)) {\n            throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);\n        }\n        //Sender already validated in preSend()\n        if ('' === $this->Sender) {\n            $smtp_from = $this->From;\n        } else {\n            $smtp_from = $this->Sender;\n        }\n        if (!$this->smtp->mail($smtp_from)) {\n            $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));\n            throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);\n        }\n\n        $callbacks = [];\n        //Attempt to send to all recipients\n        foreach ([$this->to, $this->cc, $this->bcc] as $togroup) {\n            foreach ($togroup as $to) {\n                if (!$this->smtp->recipient($to[0], $this->dsn)) {\n                    $error = $this->smtp->getError();\n                    $bad_rcpt[] = ['to' => $to[0], 'error' => $error['detail']];\n                    $isSent = false;\n                } else {\n                    $isSent = true;\n                }\n\n                $callbacks[] = ['issent' => $isSent, 'to' => $to[0], 'name' => $to[1]];\n            }\n        }\n","sourceCodeStart":2016,"sourceCodeEnd":2052,"githubUrl":"https://github.com/ellite/Wallos/blob/52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd/libs/PHPMailer/PHPMailer.php#L2016-L2052","documentation":"Thrown in smtpSend() when the SMTP server rejects the MAIL FROM envelope sender ($this->Sender, falling back to $this->From). PHPMailer first records a detailed error via setError() (localized 'from_failed' plus the address and the SMTP error), then rethrows it as $this->ErrorInfo as a critical exception. The recipient-side SMTP error text is embedded in ErrorInfo.","triggerScenarios":"Calling send() over SMTP when $this->smtp->mail($smtp_from) returns false: the server rejects the sender address (550/553/501 replies), the address is not authorized for the authenticated user (Gmail/Office365 SPF/alias rules), or the address is syntactically invalid.","commonSituations":"Gmail SMTP rejecting a From address that doesn't match the authenticated account or an approved alias/sendas, sending as a domain without SPF/DKIM alignment, empty or malformed From, or Exchange servers rejecting relay attempts from unknown senders.","solutions":["Check $mailer->ErrorInfo for the exact SMTP reply and fix the From address accordingly.","Set From to an address the authenticated SMTP user is allowed to send as (the account itself or a verified alias/sendas).","Ensure From is a valid RFC address and set Sender/envelope-from explicitly if different: $mailer->Sender = 'bounce@example.com'.","Configure SPF/DKIM/DMARC for the sending domain if the server enforces alignment.","Inspect the server with SMTPDebug = DEBUG_SERVER to see the raw rejection code."],"exampleFix":"// before\n$mailer->isSMTP();\n$mailer->Username = 'noreply@example.com';\n$mailer->From = 'someone@gmail.com'; // not allowed for this account\n// after\n$mailer->isSMTP();\n$mailer->Username = 'noreply@example.com';\n$mailer->From = 'noreply@example.com';\n$mailer->Sender = 'noreply@example.com';","handlingStrategy":"validation","validationCode":"if (!filter_var($mailer->From, FILTER_VALIDATE_EMAIL)) {\n    throw new InvalidArgumentException(\"Invalid From address: {$mailer->From}\");\n}\n$allowed = ['noreply@example.com', 'support@example.com'];\nif (!in_array($mailer->From, $allowed, true)) {\n    throw new InvalidArgumentException('From not authorized for this SMTP account');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $mailer->send();\n} catch (PHPMailer\\PHPMailer\\Exception $e) {\n    if (str_contains($mailer->ErrorInfo, 'from_failed')) {\n        error_log('MAIL FROM rejected: ' . $mailer->ErrorInfo); // includes server reply\n    }\n}","preventionTips":["Send From as the authenticated account or a verified alias/sendas.","Keep envelope Sender aligned with From to satisfy SPF/DMARC.","Never hardcode arbitrary user-supplied From values.","Read the embedded server reply in ErrorInfo when diagnosing."],"tags":["php","phpmailer","smtp","from-address","email-delivery"],"backgroundTag":"api-error-response","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"}