smtplib starttls gmail example

Discussion in 'Python' started by py, Jan 23, 2007.

  1. py

    py Guest

    from smtplib import SMTP
    from socket import sslerror #if desired
    server = SMTP('smtp.gmail.com')
    server.set_debuglevel(0) # or 1 for verbosity
    server.ehlo('')
    server.starttls()
    server.ehlo('') # say hello again
    server.login('', 'yourpassword')
    # i have a suspicion that smptlib does not add the required newline dot newline so i do it myself
    server.sendmail('', '', message_text + '\n.\n')
    # next line generates the ignorable socket.sslerror
    server.quit()
     
    py, Jan 23, 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. Tim Williams

    smtplib STARTTLS problems

    Tim Williams, Apr 12, 2005, in forum: Python
    Replies:
    0
    Views:
    450
    Tim Williams
    Apr 12, 2005
  2. Jean-Paul Calderone

    Re: smtplib starttls gmail example

    Jean-Paul Calderone, Jan 23, 2007, in forum: Python
    Replies:
    0
    Views:
    419
    Jean-Paul Calderone
    Jan 23, 2007
  3. Tim Williams
    Replies:
    0
    Views:
    472
    Tim Williams
    Jan 24, 2007
  4. DJ Fadereu

    Gmail Error using smtplib

    DJ Fadereu, Jul 20, 2007, in forum: Python
    Replies:
    1
    Views:
    3,544
    supercooper
    Jul 20, 2007
  5. Evan
    Replies:
    3
    Views:
    490
Loading...

Share This Page