From a66dd58211c01580f9f0d29b8828f8ee224bd004 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 18 Mar 2013 06:47:46 -0400 Subject: [PATCH] email: Remove explicit ehlo() call It won't work before we've connected to the server: Traceback (most recent call last): ... File ".\rss2email\email.py", line 145, in smtp_send smtp.ehlo() ... smtplib.SMTPServerDisconnected: please run connect() first That makes sense ;). If we want to call ehlo(), we should certainly do it after the .connect() call succeeds. Looking at the docs [1], I don't think we need to call it at all: Unless you wish to use has_extn() before sending mail, it should not be necessary to call this method explicitly. It will be implicitly called by sendmail() when necessary. We don't use has_extn(), and the EHLO should happen implicitly in starttls [2]: If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. and send_message [3]: This is a convenience method for calling sendmail()... via sendmail [4]: If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. [1]: http://docs.python.org/3/library/smtplib.html#smtplib.SMTP.ehlo [2]: http://docs.python.org/3/library/smtplib.html#smtplib.SMTP.starttls [3]: http://docs.python.org/3/library/smtplib.html#smtplib.SMTP.send_message [4]: http://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail Reported-by: Matt Bordignon Signed-off-by: W. Trevor King --- rss2email/email.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rss2email/email.py b/rss2email/email.py index a30ba08..4bfd198 100644 --- a/rss2email/email.py +++ b/rss2email/email.py @@ -142,7 +142,6 @@ def smtp_send(sender, recipient, message, config=None, section='DEFAULT'): smtp = _smtplib.SMTP_SSL() else: smtp = _smtplib.SMTP() - smtp.ehlo() try: smtp.connect(SMTP_SERVER) except KeyboardInterrupt: -- 2.26.2