title: error in connecting to a smtp server with python
body: <p>import smtplib</p>
  
  <p>SERVER = "my.smtp.server.com"</p>
  
  <p>FROM = "myemail@somehost.ca"
  TO = ["someemail@somehost.mun.ca"] # must be a list</p>
  
  <p>SUBJECT = "Hello!"</p>
  
  <p>TEXT = "hello"</p>
  
  <p>Here is my code:</p>
  
  <pre><code># Prepare actual message
  
  message = """\
  From: %s
  To: %s
  Subject: %s
  
  %s
  """ % (FROM, ", ".join(TO), SUBJECT, TEXT)
  
  # Send the mail
  
  server = smtplib.SMTP(SERVER)
  server.login('loginname','password') 
  </code></pre>
  
  <p>and this is the error I get:</p>
  
  <pre><code>Traceback (most recent call last):
  File "C:\Documents and Settings\Desktop\New Text Document.py", line 24, in ?
  server = smtplib.SMTP(SERVER)
    File "C:\Python24\lib\smtplib.py", line 241, in __init__
      (code, msg) = self.connect(host, port)
    File "C:\Python24\lib\smtplib.py", line 289, in connect
      for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
  gaierror: (11001, 'getaddrinfo failed')
  </code></pre>
  
  <p>what do I do next?</p>