[Tutor] smtplib alternative???

Adisegna adisegna at gmail.com
Sun Nov 20 03:33:52 CET 2005


Hello,

I found this script to send mail online. It works fine but requires me to
enter an mail server. I'm looking for something else that doesn't require
and SMTP server. Having to specify a mail server prohibits me from sending
to alternate domains.

Thanks in advance


smtpserver = 'my.mailserver.com <http://my.mailserver.com>'
RECIPIENTS = ['myaddress at goeshere.com']
SENDER = 'Somethin at something.com'
mssg = SomeVariable

session = smtplib.SMTP(smtpserver)
smtpresult = session.sendmail(SENDER, RECIPIENTS, mssg)
if smtpresult:
errstr = ""
for recip in smtpresult.keys():
errstr = """Could not delivery mail to: %s

Server said: %s
%s

%s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
raise smtplib.SMTPException, errstr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051119/774336a2/attachment.html


More information about the Tutor mailing list