error in connecting to a smtp server with python
Question: import smtplib

SERVER = "my.smtp.server.com"

FROM = "myemail@somehost.ca" TO = ["someemail@somehost.mun.ca"] # must be a
list

SUBJECT = "Hello!"

TEXT = "hello"

Here is my 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') 
    

and this is the error I get:

    
    
    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')
    

what do I do next?


Answer: There is no ip for `my.smtp.server.com` in your **dns** or **/etc/hosts** ?

-> [DNS Wikipedia](http://en.wikipedia.org/wiki/Domain_Name_System)

is `my.smtp.server.com` a real (smtp-)server ?

have tried a telnet to port 25 of `my.smtp.server.com` ?

firewall problems ?

if you need a test-server -> [lamson](http://lamsonproject.org/)

