updated smtplib with auth support

Grzegorz Makarewicz mak at mikroplan.com.pl
Fri Oct 1 06:40:06 EDT 1999


Hi folk

I'v added new exception SMTPAuthError and two methods: helo_ehlo,auth

small fixes in:
putcmd - extra space and end of line
ehlo - updated regexp for featurs parser

Now we can use relaying for authenticated users only available in
zmailer,postfix,exchange,netscape.
#
#<sample>
import smtplib
def demo():
        host='mikroplan.com.pl'
        fromaddr='<mak at mikroplan.com.pl>'
        toaddrs=['python-list at python.org',]
        server = smtplib.SMTP(host,25)
        server.set_debuglevel(0)
        server.helo_ehlo()
        msg=open(data,'rt').read()
        if server.does_esmtp and server.has_extn('AUTH=LOGIN'):
                server.auth('user','password')
        server.sendmail(fromaddr, toaddrs, msg)
        server.quit()

demo()
#</sample>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smtplib.py
Type: application/octet-stream
Size: 18996 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/19991001/e65c14cd/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smtplib.diff
Type: application/octet-stream
Size: 2622 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/19991001/e65c14cd/attachment-0001.obj>


More information about the Python-list mailing list