Digital Marketing

Python email by smtplib example

"""The first step is to create an SMTP object, each object is used for connection
with one server."""

import smtplib
server = smtplib.SMTP('smtp.goyun.info', 587)
#for debug
server.set_debuglevel(1)
#TLS
server.starttls()
#Next, log in to the server
server.login("user-name", "password")

#Send the mail
msg = "\n\nHello!" # The /n separates the message from the headers
server.sendmail("sender@goyun.info", "recipient@goyun.info", msg)
server.quit()


Comments

Popular posts from this blog

Make online money from the Internet