{"record":{"id":"fae31806dc993b5b","repo":"ellite/Wallos","slug":"this-lang-data-not-accepted","errorCode":null,"errorMessage":"$this->lang('data_not_accepted')","messagePattern":"\\$this->lang\\('data_not_accepted'\\)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"libs/PHPMailer/PHPMailer.php","lineNumber":2055,"sourceCode":"        $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\n        //Only send the DATA command if we have viable recipients\n        if ((count($this->all_recipients) > count($bad_rcpt)) && !$this->smtp->data($header . $body)) {\n            throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL);\n        }\n\n        $smtp_transaction_id = $this->smtp->getLastTransactionID();\n\n        if ($this->SMTPKeepAlive) {\n            $this->smtp->reset();\n        } else {\n            $this->smtp->quit();\n            $this->smtp->close();\n        }\n\n        foreach ($callbacks as $cb) {\n            $this->doCallback(\n                $cb['issent'],\n                [[$cb['to'], $cb['name']]],\n                [],\n                [],\n                $this->Subject,","sourceCodeStart":2037,"sourceCodeEnd":2073,"githubUrl":"https://github.com/ellite/Wallos/blob/52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd/libs/PHPMailer/PHPMailer.php#L2037-L2073","documentation":"Thrown in smtpSend() when at least one recipient was accepted but the server rejects the message content during the DATA phase: $this->smtp->data($header . $body) returns false. The localized 'data_not_accepted' message is thrown as a critical exception. This means the session and recipients were fine but the server refused the actual message.","triggerScenarios":"Calling send() over SMTP when smtp->data() fails: server rejects message content (554), message too large, malformed headers from bad encodings/custom headers, anti-spam filters rejecting content, or connection dropped mid-DATA.","commonSituations":"Oversized attachments exceeding the server's message-size limit, spam filters (Rspamd/SpamAssassin) rejecting content or missing headers, invalid injected headers causing protocol desync, greylisting/content policies on corporate relays.","solutions":["Enable SMTPDebug = DEBUG_SERVER and read the SMTP reply after DATA (e.g. 552 = too large, 554 = rejected content).","Reduce message size: shrink or remove attachments (check server size limit, often 10-25MB).","Inspect custom headers for invalid values/newlines; use $mailer->addCustomHeader() with clean values.","Add standard headers (Message-ID via $mailer->MessageID, Date, Return-Path) that spam filters require.","Retest content: send a plain minimal message to isolate whether the body/attachments trigger the rejection."],"exampleFix":"// before\n$mailer->addAttachment('/path/50MB-video.mp4'); // exceeds server limit\n$mailer->send(); // SMTP error: DATA not accepted\n// after\n$mailer->addAttachment('/path/report.pdf'); // small, allowed type\n$mailer->MessageID = '<' . bin2hex(random_bytes(16)) . '@example.com>';\n$mailer->send();","handlingStrategy":"try-catch","validationCode":"$size = filesize($attachmentPath);\nif ($size > 10 * 1024 * 1024) { // 10MB server-typical limit\n    throw new InvalidArgumentException(\"Attachment {$attachmentPath} exceeds server DATA limit\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    $mailer->send();\n} catch (PHPMailer\\PHPMailer\\Exception $e) {\n    if (str_contains($mailer->ErrorInfo, 'data_not_accepted') || str_contains($mailer->ErrorInfo, 'DATA')) {\n        error_log('SMTP DATA rejected: ' . $mailer->ErrorInfo); // 552=too large, 554=content\n        // shrink message or strip attachments and retry\n    }\n}","preventionTips":["Keep total message size under the server's DATA limit (query via SIZE extension or docs).","Avoid injecting raw header values; use addCustomHeader/addStringAttachment APIs.","Include Message-ID/Date headers to satisfy spam filters.","Test content changes against a debug mailbox before production sends."],"tags":["php","phpmailer","smtp","data-command","email-delivery"],"backgroundTag":"payload-too-large","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"}