title: I'm trying to send email through 'localhost' in Python but it keeps giving me an "Error 61"
body: <p>I'm running a Mac OS X and used postfix to enable localhost.
  This is the error message I get:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 239, in __init__
      (code, msg) = self.connect(host, port)
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 295, in connect
      self.sock = self._get_socket(host, port, self.timeout)
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 273, in _get_socket
      return socket.create_connection((port, host), timeout)
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
      raise err
  socket.error: [Errno 61] Connection refused
  </code></pre>