how to use smtp starttls() encryption?

Gerhard Häring gerhard.haering at gmx.de
Thu Oct 17 07:44:56 EDT 2002


* Xu, C.S. <xucs007 at yahoo.com> [2002-10-16 23:36 -0700]:
> Now I've changed my smtplib.py correspondingly,
> the next step ".login(frm, password)", I met
> problem:
> 
> [...]
> send: 'AUTH PLAIN c2FsZXNAb2ZmbGVhc2Vjb21wdXRlci5uZXQAc2FsZXNAb2ZmbGVhc2Vjb21wdXRlci5uZXQAMTIz\nb2xj\r\n'
> reply: '535 Incorrect authentication data\r\n'
> reply: retcode (535); Msg: Incorrect authentication data
> Traceback (most recent call last):
>    File "./aa", line 16, in ?
>     server.login(frm, password)
>   File "/usr/lib/python2.2/smtplib.py", line 546, in login
>     raise SMTPAuthenticationError(code, resp)
> smtplib.SMTPAuthenticationError: (535, 'Incorrect authentication data')

I believe you've hit the bug that I fixed for Python 2.2.2: base64
encoding of strings > 60 chars did insert additional newlines (\n),
which seems to happen in your case.

Please upgrade to Python 2.2.2. If that's not possible, get a smtplib.py
of Python 2.2.2 and use it instead.

-- Gerhard




More information about the Python-list mailing list