SMTP Service Extension for Message Size Declaration
Extracted elements (19)
Clients are advised to use heuristics that overestimate rather than underestimate message size, which makes the question of whether SMTP DATA dots are counted largely academic and reduces the chance of a mid-transfer rejection.
The extension is motivated by MIME's expansion of message sizes; the goal is to allow early rejection before any data transfer, saving resources on both client and server.
Only one SIZE parameter may be specified in a single MAIL FROM command.
The extension is negotiated via EHLO (RFC 1869 ESMTP framework). Servers that do not support SIZE will not advertise it, and clients must fall back to standard SMTP behavior without size pre-declaration.
A 250 reply to the extended MAIL command is not an absolute guarantee of successful transfer; clients must still handle 452 and 552 error codes after DATA or after message transfer.
A minimal server must accept the extended MAIL command and return 552 if the declared size exceeds its fixed maximum, but need not detect temporary resource limitations.
A server may return 452 or 552 in response to a RCPT command based on per-recipient unwillingness to accept a message of the declared size. A 452 allows requeue; a 552 does not.
A server returning SIZE with no parameter in EHLO may not issue a 250 response to an extended MAIL command with a SIZE value without first verifying sufficient resources are available and, if possible, reserving storage space.
If the declared message size exceeds the server's fixed maximum, the server responds with code 552 ('message size exceeds fixed maximum message size').
If the server currently lacks sufficient resources to accept a message of the indicated size but may be able to do so later, it responds with code 452 ('insufficient system storage').
Once a server has accepted a declared message size, it should not return a 552 after the DATA transfer phase unless the actual transferred message size exceeds the declared size.
Servers MUST NOT use the SIZE parameter to determine end of content in the DATA command; it is only an estimate for pre-transfer resource checking.
Upon receiving a 452 response, the client should send RSET or QUIT and retry delivery to the same server at a later time.
Upon receiving a 552 response, the client should send RSET or QUIT, declare the message undeliverable, and return appropriate notification to the sender.
Message size is defined as the number of octets including CR-LF pairs transmitted after the server's 354 reply to DATA, but excluding the terminating dot and doubled quoting dots.
The SMTP SIZE extension is identified by the EHLO keyword 'SIZE'. An optional decimal parameter indicates the server's fixed maximum message size in bytes; a value of 0 means no fixed maximum; omission means no information is conveyed.
The SIZE extension can facilitate crude service-denial attacks by making it quicker to determine effective attack parameters (server limits) and by streamlining the setup of large-message flood attempts. However, the extension does not introduce vulnerabilities beyond those already present in SMTP.
The EHLO SIZE keyword parameter syntax is `size-param ::= [1*DIGIT]`, an optional decimal number representing the server's fixed maximum message size in bytes.
The SIZE parameter on MAIL FROM carries a decimal integer (1–20 digits) representing the declared message size in octets. Syntax: `size-value ::= 1*20DIGIT`. The MAIL FROM line length limit is increased by 26 characters to accommodate this parameter.