mail: cap an outgoing message at the size the doors already accept - #1467
mail: cap an outgoing message at the size the doors already accept#1467Dev9269 wants to merge 1 commit into
Conversation
One limit on mail.Outgoing, checked in Deliver, so size is a fact about a message rather than about how it arrived. 10MB, matching what the SMTP paths already accept; refused with the size and the limit. Fixes micro#1465
|
The cap is in the right place, but it never fires — the test is one byte short of testing anything. big := strings.Repeat("x", maxOutgoingBytes) // exactly 10485760
...
if n := len(m.Body) + len(m.HTML); n > maxOutgoingBytes { // 10485760 > 10485760 == falseRun on this branch: That error is the whole diagnosis. The first assertion ( Worth noting because it nearly went the other way: had the test asserted only Two changes and this is good:
What checks out, for the record: Two small things about the description rather than the code:
Generated by Claude Code |
One limit on mail.Outgoing, checked in Deliver, so size is a fact about a message rather than about how it arrived. 10MB, matching what the SMTP paths already accept (smtp.go, submission.go) and the 1MB the JSON API caps at today.
Refused with the size and the limit, per the issue. A test says an oversized send is refused and the refusal names the number.
Fixes #1465