how to use smtp starttls() encryption?

Xu, C.S. xucs007 at
Thu Oct 17 08:36:39 CEST 2002

Now I've changed my correspondingly,
the next step ".login(frm, password)", I met

> send: 'STARTTLS\r\n'
> reply: '220 OpenSSL/0.9.5beta go ahead\r\n'
> reply: retcode (220); Msg: OpenSSL/0.9.5beta go ahead
> send: 'ehlo localhost.localdomain\r\n'
> reply: ' Hello []\r\n'
> reply: '250-SIZE\r\n'
> reply: '250-PIPELINING\r\n'
> reply: '250-AUTH PLAIN LOGIN\r\n'
> reply: '250 HELP\r\n'                                                         > reply: retcode (250); Msg: Hello []
> AuthMethod: PLAIN                                                             > 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/", line 546, in login
>     raise SMTPAuthenticationError(code, resp)
> smtplib.SMTPAuthenticationError: (535, 'Incorrect authentication data')

The kmail from Mandrake Linux 9.0 can work with my smtp server,
plus, it tested my smtp server uses TLS encryption, and uses
LOGIN (not PLAIN, CRAM-MD5 etc) as the authentication method. 
Kmail does ask me whether I accept some certificate or not. 

Now what should I do in python in order to send out mails?

Thanks again.

More information about the Python-list mailing list