tags:

views:

40

answers:

2

import smtplib

SERVER = "my.smtp.server.com"

FROM = "[email protected]" TO = ["[email protected]"] # 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?

A: 

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

-> DNS Wikipedia

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

Blauohr
my.smtp.server.com was just a place holder. anyways It was just a simple typo... as is the cause of many scripting errors. Thanks for the help
Richard
A: 

Maybe your dns is not working. Perhaps my.smtp.server.com is a placeholder, if so substitute the real mail server name in there

gnibbler