how to use smtp starttls() encryption?

Xu, C.S. xucs007 at yahoo.com
Sat Oct 12 12:05:51 EDT 2002


> Now, before invoking login, you invoke starttls. This causes the
> connection to become encrypted, which, in turn, protects your password
> against being snooped.

When I tried starttls(), the next step server.sendmail(frm, to, msg)
got problem:

> 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'
> Traceback (most recent call last):
>   File "./aa", line 18, in ?
>     server.sendmail(frm, to, msg)
>   File "/usr/lib/python2.2/smtplib.py", line 621, in sendmail
>     if not (200 <= self.ehlo()[0] <= 299):
>   File "/usr/lib/python2.2/smtplib.py", line 376, in ehlo
>     self.putcmd("ehlo", socket.getfqdn())
>   File "/usr/lib/python2.2/smtplib.py", line 306, in putcmd
>     self.send(str)
>   File "/usr/lib/python2.2/smtplib.py", line 293, in send
>     self.sock.sendall(str)
> AttributeError: SSLFakeSocket instance has no attribute 'sendall'

Any suggestions? Do I need first verify some certificates?
Kmail does ask me whether I want to accept some unverified
certificates or not. But how should I do it in python?

Thanks again.



More information about the Python-list mailing list