[Python-Dev] smtplib violates SMTP spec

Aahz aahz at pythoncraft.com
Sun Feb 15 18:10:13 CET 2009


On Sun, Feb 15, 2009, Felix Schwarz wrote:
>
> I would like to get attention to issue 4142 [1] which was filed several 
> months ago. This is about a clear bug in smtplib's SMTP implementation 
> which is probably present since (at least) Python 1.5.
>
> When re-using an smtplib.SMTP instance for a second connection, smtplib 
> does not send another HELO/EHLO which is a clear violation of the SMTP 
> specification.
>
> I built a small patch (changes only 2 lines) but I'm unable to write a 
> unit test for this easily because:
>   * Python's smtpd does not check if HELO/EHLO was received before MAIL FROM
>   * Therefore any extension of test_smtplib would need some patches to check
>     this also.

If you want to increase the chance of your patch getting into 2.7/3.1,
please provide a patch against smtpd in addition to your smtplib patch.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.


More information about the Python-Dev mailing list