-1

I am trying to learn about how to send emails using Python. Using scripts from Tutorial's Point, and Stack Overflow I have created a basic script which can send emails using Gmail. I have a few questions about several lines of code. They appear to be communicating with the Gmail Server.

server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()

What does server.ehlo mean? Is it specific to gmail?

server.starttls()

What does this mean?

server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

What is server.quit()?

Community
  • 1
  • 1
xxmbabanexx
  • 8,256
  • 16
  • 40
  • 60
  • 2
    The answer to all your questions are clearly described in the [smtplib documentation](http://docs.python.org/2/library/smtplib.html). – jordanm Apr 13 '13 at 18:39

1 Answers1

1

ehlo is part of the protocol exchange between the client side and server side ehlo gives the name of the client side to the server

starttls starts up the encryption and authentication for the SSL socket layer

login sends credentials as described in the SMTP spec

sendmail does the other SMTP protocol commands, mail from, rcpt to and data

quit sends a command to close the connection from the server end

Vorsprung
  • 32,923
  • 5
  • 39
  • 63