smtplib and passwd's

Gerhard Häring gerhard.haering at gmx.de
Thu Jul 18 11:34:25 EDT 2002


* Rajarshi Guha <rajarshi at presidency.com> [2002-07-18 11:04 -0400]:
> Hi,
> I'm using smtplib to let my script send some mail through my smtp
> server. However I need a logon and passwd for my smtp server - how
> does smtplib handle such servers? Where can I specify my username and
> password?

import smtplib

srv = smtplib.SMTP("mail.myprovider.com")
srv.debuglevel = 25
srv.login("myname", "mypassword")
# ...

You need at least Python 2.2 for this login method to be available.
OTOH backporting SMTP AUTH to earlier Python versions would certainly be
possible. If there are problems, report back to me and I can send you an
improved version (bugfixes, support for old auth advertising, and
additional LOGIN auth method) that will (most likely) end up in Python
2.3.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 17.9 °C      Wind: 6.2 m/s





More information about the Python-list mailing list