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?