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. Advertisements

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:
    556
    Tim Williams
    Apr 12, 2005
  2. DJ Fadereu

    Gmail Error using smtplib

    DJ Fadereu, Jul 20, 2007, in forum: Python
    Replies:
    1
    Views:
    3,721
    supercooper
    Jul 20, 2007
  3. Roger
    Replies:
    0
    Views:
    619
    Roger
    Aug 5, 2007
  4. Evan
    Replies:
    3
    Views:
    782
  5. Michele Simionato

    STARTTLS extension not supported by server

    Michele Simionato, Nov 15, 2010, in forum: Python
    Replies:
    2
    Views:
    2,447
    Michele Simionato
    Nov 29, 2010
  6. Greg Hurrell
    Replies:
    1
    Views:
    143
    Minero Aoki
    Mar 31, 2007
  7. Henrik Hodne
    Replies:
    1
    Views:
    164
    Kouhei Sutou
    Mar 20, 2009
  8. JGH

    Mail::Sender and STARTTLS

    JGH, Jul 23, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    1,431
    Ilmari Karonen
    Jul 24, 2004
Loading...