Re: smtplib "authentication required" error

Discussion in 'Python' started by 7stud, May 18, 2008.

  1. 7stud

    7stud Guest

    On May 17, 12:18 pm, cher <> wrote:
    > Hey,
    >
    > Don't know if you can help, but I'm trying to import archived messages
    > from Thunderbird into my gmail account and keep getting these types of
    > errors.  I am using the GML program to help incorporate, but the SMTP
    > server is not being recognized by gmail.  Am I doing something wrong?  
    > Anything else I can try?
    > SMTP I've tried:
    >     smtp.gmail.com
    >     gsmtp56.google.com
    >
    > Error Val : (530, '5.7.0 Must issue a STARTTLS command first.
    > m29sm9416768poh.4',
    > *** 76 ERROR SENDING MESSAGE FROM:
    > *** UNABLE TO CONNECT TO SERVER OR SEND MESSAGE. ERROR FOLLOWS.
    > Error Type: smtplib.SMTPSenderRefused
    > Error Val : (530, '5.7.0 Must issue a STARTTLS command first.
    > n22sm9448670pof.3', '')
    >
    > Thanks,
    > Cher


    Can you get the following program to work?


    #Uses gmail to send an email to someone

    import smtplib

    sender = "Tom"
    to = "Sally"
    subject = "Test smtplib"

    headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (sender, to,
    subject)
    msg = headers + "Hello. How are you?"

    mailserver = smtplib.SMTP("smtp.gmail.com", 587)
    mailserver.ehlo()
    mailserver.starttls()
    mailserver.ehlo()
    mailserver.login("your_gmail_email_address", "your_gmail_password")
    mailserver.sendmail("your_gmail_email_addres",
    "a_destination_email_address", msg)
    mailserver.close()
    7stud, May 18, 2008
    #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. yazzoo

    smtplib data error

    yazzoo, May 24, 2004, in forum: Python
    Replies:
    3
    Views:
    753
    Peter Hansen
    May 25, 2004
  2. Van_Gogh
    Replies:
    3
    Views:
    513
    Tim Roberts
    Jan 8, 2006
  3. Replies:
    2
    Views:
    6,209
  4. cher
    Replies:
    0
    Views:
    313
  5. Evan
    Replies:
    3
    Views:
    460
Loading...

Share This Page