title: Failing to send email with the Python example
body: <p>I've been trying (and failing) to figure out how to send email via Python.</p>
  
  <p>Trying the example from here:
  <a href="http://docs.python.org/library/smtplib.html#smtplib.SMTP" rel="noreferrer">http://docs.python.org/library/smtplib.html#smtplib.SMTP</a></p>
  
  <p>but added the line <code>server = smtplib.SMTP_SSL('smtp.gmail.com', 465)</code> after I got a bounceback about not having an SSL connection.  </p>
  
  <p>Now I'm getting this:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Python26/08_emailconnects/12_29_EmailSendExample_NotWorkingYet.py", line 37, in &lt;module&gt;
      server = smtplib.SMTP('smtp.gmail.com', 65)
    File "C:\Python26\lib\smtplib.py", line 239, in __init__
      (code, msg) = self.connect(host, port)
    File "C:\Python26\lib\smtplib.py", line 295, in connect
      self.sock = self._get_socket(host, port, self.timeout)
    File "C:\Python26\lib\smtplib.py", line 273, in _get_socket
      return socket.create_connection((port, host), timeout)
    File "C:\Python26\lib\socket.py", line 512, in create_connection
      raise error, msg
  error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Thoughts?</p>
  
  <hr>
  
  <p>server = smtplib.SMTP("smtp.google.com", 495) gives me a timeout error.  just smtplib.smtp("smtp.google.com", 495) gives me "SSLError: [Errno 1] _ssl.c:480: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol" (see below).</p>
  
  <p>I'm trying different ports and now I'm getting a completely new error.  I'll just post the whole bit of code, I'm probably making some rookie mistake.</p>
  
  <p>"</p>
  
  <pre><code>import smtplib
  
  mailuser = 'MYEMAIL@gmail.com'
  
  mailpasswd = 'MYPASSWORD'
  
  fromaddr = 'MYEMAIL@gmail.com'
  
  toaddrs = 'MYEMAIL2@gmail.com'
  
  msg = 'Hooooorah!'
  
  print msg
  
  server = smtplib.SMTP_SSL('smtp.google.com')
  
  server = smtplib.SMTP_SSL_PORT=587
  
  server.user(mailuser)
  
  server.pass_(mailpasswd)
  
  server.set_debuglevel(1)
  
  server.sendmail(fromaddr, toaddrs, msg)
  
  server.quit()
  </code></pre>
  
  <p>"</p>
  
  <p>and then I get this error message: "</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Python26/08_emailconnects/12_29_eMAILSendtryin_stripped.py", line 16, in &lt;module&gt;
      server = smtplib.SMTP_SSL('smtp.google.com')
    File "C:\Python26\lib\smtplib.py", line 749, in __init__
      SMTP.__init__(self, host, port, local_hostname, timeout)
    File "C:\Python26\lib\smtplib.py", line 239, in __init__
      (code, msg) = self.connect(host, port)
    File "C:\Python26\lib\smtplib.py", line 295, in connect
      self.sock = self._get_socket(host, port, self.timeout)
    File "C:\Python26\lib\smtplib.py", line 755, in _get_socket
      self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile)
    File "C:\Python26\lib\ssl.py", line 350, in wrap_socket
      suppress_ragged_eofs=suppress_ragged_eofs)
    File "C:\Python26\lib\ssl.py", line 118, in __init__
      self.do_handshake()
    File "C:\Python26\lib\ssl.py", line 293, in do_handshake
      self._sslobj.do_handshake()
  SSLError: [Errno 1] _ssl.c:480: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
  </code></pre>
  
  <p>"</p>
  
  <p>note that actually the which looks like "server = smtplib.SMTPSSLPORT=587" is actually "server = smtplib.SMTP <em>underscore</em> SSL <em>underscore</em> PORT=587", there's some sort of formatting thing going on here.</p>