Skip to content

Email

MIME

SMTP

SMTP (Simple mail transfer protocol) is used instead of HTTP to send emails... dumb

  • generally uses port 465 or 587
  • dictates how email messages should be formatted/encripted/relayed between mail servers
$ import smtplib
$ smtp = smtplib.SMTP('smtp.gmail.com', 587)
$ smtp.ehlo()
$ smtp.ttls() # create secure connection
# CREDENTIALS
# Create app password (same username)
# https://support.google.com/mail/?p=InvalidSecondFactor
$ smtpObj.login('ab18gu@gmail.com', '<app-password>')
$ smtpObj.sendmail('ab18gu@gmail.com', 'you@gmail.com', 'Subject: This is automated\nweird...')
$ smtpObj.quit()

GMAIL

IMAP

IMAP (Internet Message Access Protocol) used to recieve emails... dumb

  • generally listens on port 143

In addition to these, some security protocols are embedded into these protocols.