title: Python SMTP Not Working For Me - Mail Not Sent Empty Dictionary Returned
body: <p>I am trying to send mail via Python's smtplib module. </p>
  
  <p>I found a couple of examples online but none of them have worked so far. I am able to connect to the SMTP server with no authentication as this server does not use a password. However, when I use the <code>sendmail</code> method the mail is not sent to me and an empty dictionary is returned to the interactive Python shell.</p>
  
  <p>I do not have direct access to the SMTP server logs to try and debug this, but maybe able to get some help with this. </p>
  
  <p>The screenshot that follows points out areas of interest/concern. Also, I copy and pasted the text from the Python interactive shell for you and your screen-reader, which could be quite handy and fun. </p>
  
  <p>I changed some of the names like my e-mail address and the exact name of the mail server. I do not actually work at job.com if that is a domain or business. Thanks for reading this. I am very skeptical this will be solved! :/ </p>
  
  <p><a href="https://i.stack.imgur.com/VB21k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VB21k.png" alt="screen shot of python 2.7 smtp trouble"></a></p>
  
  <pre><code>Python 2.7.5 (default, Aug  4 2017, 00:39:18)
  [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import smtplib
  &gt;&gt;&gt; SERVER = smtplib.SMTP()
  &gt;&gt;&gt; SERVER.connect('mail.devexchange.local')
  (220, 'interzone.devexchange.local Microsoft ESMTP MAIL Service ready at Mo                                             n, 4 Jun 2018 19:58:21 -0500')
  &gt;&gt;&gt; help(SERVER)
  
  &gt;&gt;&gt; SERVER.help()
  'This server supports the following commands:\nHELO EHLO STARTTLS RCPT DATA RSET                                              MAIL QUIT HELP AUTH BDAT'
  &gt;&gt;&gt; help(SERVER)
  
  &gt;&gt;&gt; SERVER.getreply()
  
  
  
  (451, '4.7.0 Timeout waiting for client input')
  &gt;&gt;&gt;
  &gt;&gt;&gt;
  &gt;&gt;&gt;
  &gt;&gt;&gt; SERVER.send('me@me.com', 'myemail@job.com', 'hello from smtp')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: send() takes exactly 2 arguments (4 given)
  &gt;&gt;&gt; SERVER.sendmail('me@me.com', 'myemail@job.com', 'hello from smtp')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/lib64/python2.7/smtplib.py", line 722, in sendmail
      self.ehlo_or_helo_if_needed()
    File "/usr/lib64/python2.7/smtplib.py", line 541, in ehlo_or_helo_if_needed
      if not (200 &lt;= self.ehlo()[0] &lt;= 299):
    File "/usr/lib64/python2.7/smtplib.py", line 412, in ehlo
      self.putcmd(self.ehlo_msg, name or self.local_hostname)
    File "/usr/lib64/python2.7/smtplib.py", line 340, in putcmd
      self.send(str)
    File "/usr/lib64/python2.7/smtplib.py", line 330, in send
      raise SMTPServerDisconnected('Server not connected')
  smtplib.SMTPServerDisconnected: Server not connected
  &gt;&gt;&gt; SERVER.connect('mail.devexchange.local')
  (220, 'interzone.devexchange.local Microsoft ESMTP MAIL Service ready at Mo                                             n, 4 Jun 2018 20:13:18 -0500')
  &gt;&gt;&gt; SERVER.sendmail('me@me.com', 'myemail@job.com', 'hello from smtp')
  {}
  &gt;&gt;&gt;
  </code></pre>
  
  <p><strong>UPDATE</strong> - Looks like my office is filtering this and not letting the e-mail be sent. I suppose the code is great, just not my organization's security policy. :/ </p>