A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/347472.html below:

problems with smtplib

problems with smtplibJon Hewer jonhewer at gmail.com
Fri Sep 2 05:59:13 EDT 2005
hi

having a few problems sending an email with smtplib.  i do have an
smtp server running on port 25 of my local machine

here's the relevant code (taken from python docs):

s = smtplib.SMTP('localhost')
s.connect()
s.sendmail(me, to, msg.as_string())
s.close()

and i'm getting this error:

Traceback (most recent call last):
  File "pysendmail.py", line 31, in ?
    s = smtplib.SMTP()
  File "/usr/lib/python2.3/smtplib.py", line 254, in __init__
    addr = socket.gethostbyname(socket.gethostname())
socket.gaierror: (-2, 'Name or service not known')

if i don't sepcify 'localhost' i get the same error

if i specify the port and local_hostname too

class SMTP([host[, port[, local_hostname]]])

then my script just freezing at some point trying to connect/send and
the email doesn't get sent

if anyone can help that would be great...

jon

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4