trancos30 / subethasmtp

Automatically exported from code.google.com/p/subethasmtp
Other
1 stars 0 forks source link

Support SIZE extension (RFC 1870) #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Subethasmtp should support the SIZE extension. I've implemented the
following, please see the attached patch:
- Server: Have an int field that specifies the maximum size of the message.
- EHLO command: Advertise the maximum message size of the server if it's
larger than 0.
- MAIL command: Parse the parameters. If it contains a SIZE parameter,
compare it to the server max and reject the message if larger.
- Implement unit tests. Regression/Bug in "invalid adress" fixed.
- Session: Remember the value the client has given.

I believe the parsing of the MAIL FROM argument was wrong, I corrected it
in EmailUtils. I hope the comments in the code are helpful.

I would like to know what the maintainers think about this code.
Furthermore I would like to make the SIZE argument available to the API
user (MessageHandler). The user can then reject the message for specific
recipients (see RFC 1870).
Idea: Extend MessageHandler to include a callback in case the client
supplies a SIZE parameter.

Plus the Data Command could be made aware of the maximum message size
(server default and user supplied) and reject the message if it is too large. 

Comments welcome!

Original issue reported on code.google.com by andreas....@gmail.com on 23 Sep 2009 at 9:59

Attachments:

GoogleCodeExporter commented 9 years ago
Applied, however the session member variable has been renamed to 
delcaredMessageSize, since that is what it 
is.  The max is defined in SMTPServer, the Session (in the patch provided) 
tracks what the client says.

Original comment by lhori...@gmail.com on 28 Sep 2009 at 9:02