Re: How to use TLS lite

Discussion in 'Python' started by Jean-Paul Calderone, Jun 8, 2007.

  1. On Sat, 9 Jun 2007 05:58:41 +1000 (EST), Mr SZ <> wrote:
    >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('smtp.gmail.com',587)
    >connection.set_debuglevel(1)
    >msg = "Subject:Testing \n Hello"
    >connection.starttls('','password')
    >connection.sendmail("","",msg)
    >
    >In return this is what I get:
    >
    >wiki@wiki-desktop:~/Desktop$ python smtp2.py
    >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 [127.0.1.1]\r\n'
    >reply: '250-mx.google.com at your service, [59.93.118.190]\r\n'
    >reply: '250-SIZE 28311552\r\n'
    >reply: '250-8BITMIME\r\n'
    >reply: '250-STARTTLS\r\n'
    >reply: '250 ENHANCEDSTATUSCODES\r\n'
    >reply: retcode (250); Msg: mx.google.com at your service, [59.93.118.190]
    >SIZE 28311552
    >8BITMIME
    >STARTTLS
    >ENHANCEDSTATUSCODES
    >send: 'mail FROM:<> 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 "smtp2.py", line 7, in <module>
    > connection.sendmail("","",msg)
    > File "/usr/lib/python2.5/smtplib.py", line 684, in sendmail
    > raise SMTPSenderRefused(code, resp, from_addr)
    >smtplib.SMTPSenderRefused: (530, '5.7.0 Must issue a STARTTLS command first m75sm2193378wrm', '')
    >
    >Where am I going wrong?
    >


    Notice that in response to the STARTTLS you sent, you received this
    response:

    503 5.5.1 EHLO/HELO first m75sm2193378wrm

    The command was rejected and ignored and TLS was not initiated. You need
    to send the STARTTLS later.

    Jean-Paul
     
    Jean-Paul Calderone, Jun 8, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick Thomas
    Replies:
    4
    Views:
    383
    Stephan Deibel
    Aug 13, 2003
  2. Trevor Perrin

    ANN: TLS Lite 0.2.0

    Trevor Perrin, Feb 20, 2004, in forum: Python
    Replies:
    0
    Views:
    364
    Trevor Perrin
    Feb 20, 2004
  3. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    792
    Aaron Brady
    Jan 1, 2009
  4. Jane Humbrey
    Replies:
    5
    Views:
    296
    Jane Humbrey
    Sep 1, 2003
  5. Ted Byers
    Replies:
    0
    Views:
    303
    Ted Byers
    Jun 24, 2010
Loading...

Share This Page