How to use TLS lite

Mr SZ sk8in_zombi at
Fri Jun 8 21:58:41 CEST 2007

I'm using tls lite to send mail using gmail's smtp.This is what I've done:

from tlslite.api import *
import tlslite.integration.SMTP_TLS
connection= tlslite.integration.SMTP_TLS.SMTP_TLS('',587)
msg = "Subject:Testing \n Hello"
connection.starttls('emailid at','password')
connection.sendmail("from at","to at",msg)

In return this is what I get:

wiki at wiki-desktop:~/Desktop$ python
send: 'STARTTLS\r\n'
reply: '503 5.5.1 EHLO/HELO first m75sm2193378wrm\r\n'
reply: retcode (503); Msg: 5.5.1 EHLO/HELO first m75sm2193378wrm
send: 'ehlo []\r\n'
reply: ' at your service, []\r\n'
reply: '250-SIZE 28311552\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-STARTTLS\r\n'
reply: retcode (250); Msg: at your service, []
SIZE 28311552
send: 'mail FROM:<email at> size=23\r\n'
reply: '530 5.7.0 Must issue a STARTTLS command first m75sm2193378wrm\r\n'
reply: retcode (530); Msg: 5.7.0 Must issue a STARTTLS command first m75sm2193378wrm
send: 'rset\r\n'
reply: '250 2.1.0 Flushed m75sm2193378wrm\r\n'
reply: retcode (250); Msg: 2.1.0 Flushed m75sm2193378wrm
Traceback (most recent call last):
  File "", line 7, in <module>
    connection.sendmail("email at","to at",msg)
  File "/usr/lib/python2.5/", line 684, in sendmail
    raise SMTPSenderRefused(code, resp, from_addr)
smtplib.SMTPSenderRefused: (530, '5.7.0 Must issue a STARTTLS command first m75sm2193378wrm', 'email at')

Where am I going wrong?

" life isn&#39;t heavy enough,it flies away and floats far above action"
How would you spend $50,000 to create a more sustainable environment in Australia?  Go to Yahoo!7 Answers and share your idea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list