I'm using <a href="http://trevp.net/tlslite/">tls lite</a> to send mail using gmail's smtp.This is what I've done:<br><br><span style="font-style: italic;">from tlslite.api import *</span><br style="font-style: italic;"><span style="font-style: italic;">import tlslite.integration.SMTP_TLS</span><br style="font-style: italic;"><span style="font-style: italic;">connection= tlslite.integration.SMTP_TLS.SMTP_TLS('smtp.gmail.com',587)</span><br style="font-style: italic;"><span style="font-style: italic;">connection.set_debuglevel(1)</span><br style="font-style: italic;"><span style="font-style: italic;">msg = "Subject:Testing \n Hello"</span><br style="font-style: italic;"><span style="font-style: italic;">connection.starttls('emailid@gmail.com','password')</span><br style="font-style: italic;"><span style="font-style: italic;">connection.sendmail("from@gmail.com","to@gmail.com",msg)</span><br><br>In return this is what I get:<br><br><span style="font-style:
 italic;">wiki@wiki-desktop:~/Desktop$ python smtp2.py</span><br style="font-style: italic;"><span style="font-style: italic;">send: 'STARTTLS\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: '503 5.5.1 EHLO/HELO first m75sm2193378wrm\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: retcode (503); Msg: 5.5.1 EHLO/HELO first m75sm2193378wrm</span><br style="font-style: italic;"><span style="font-style: italic;">send: 'ehlo [127.0.1.1]\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: '250-mx.google.com at your service, [59.93.118.190]\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: '250-SIZE 28311552\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: '250-8BITMIME\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: '250-STARTTLS\r\n'</span><br style="font-style:
 italic;"><span style="font-style: italic;">reply: '250 ENHANCEDSTATUSCODES\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: retcode (250); Msg: mx.google.com at your service, [59.93.118.190]</span><br style="font-style: italic;"><span style="font-style: italic;">SIZE 28311552</span><br style="font-style: italic;"><span style="font-style: italic;">8BITMIME</span><br style="font-style: italic;"><span style="font-style: italic;">STARTTLS</span><br style="font-style: italic;"><span style="font-style: italic;">ENHANCEDSTATUSCODES</span><br style="font-style: italic;"><span style="font-style: italic;">send: 'mail FROM:<email@gmail.com> size=23\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: '530 5.7.0 Must issue a STARTTLS command first m75sm2193378wrm\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: retcode (530); Msg: 5.7.0 Must issue a STARTTLS command first
 m75sm2193378wrm</span><br style="font-style: italic;"><span style="font-style: italic;">send: 'rset\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: '250 2.1.0 Flushed m75sm2193378wrm\r\n'</span><br style="font-style: italic;"><span style="font-style: italic;">reply: retcode (250); Msg: 2.1.0 Flushed m75sm2193378wrm</span><br style="font-style: italic;"><span style="font-style: italic;">Traceback (most recent call last):</span><br style="font-style: italic;"><span style="font-style: italic;">  File "smtp2.py", line 7, in <module></span><br style="font-style: italic;"><span style="font-style: italic;">    connection.sendmail("email@gmail.com","to@gmail.com",msg)</span><br style="font-style: italic;"><span style="font-style: italic;">  File "/usr/lib/python2.5/smtplib.py", line 684, in sendmail</span><br style="font-style: italic;"><span style="font-style: italic;">    raise
 SMTPSenderRefused(code, resp, from_addr)</span><br style="font-style: italic;"><span style="font-style: italic;">smtplib.SMTPSenderRefused: (530, '5.7.0 Must issue a STARTTLS command first m75sm2193378wrm', 'email@gmail.com')<br><br></span>Where am I going wrong?<span style="font-style: italic;"><br style="font-style: italic;"></span><br><BR><BR>" life isn't heavy enough,it flies away and floats far above action"<p>
        


      <hr size=1>
How would you spend $50,000 to create a more sustainable environment in Australia?  Go to Yahoo!7 Answers and <a href="http://advision.webevents.yahoo.com/aunz/lifestyle/answers/y7ans-babp_reg.html" target=_blank>share your idea</a>.