Skip to content

Instantly share code, notes, and snippets.

@lazybios
Last active August 29, 2015 14:13
Show Gist options
  • Save lazybios/f8284738e5976e5a89de to your computer and use it in GitHub Desktop.
Save lazybios/f8284738e5976e5a89de to your computer and use it in GitHub Desktop.
'''send mail by smtplib module'''
import smtplib
from email.mime.text import MIMEText
'''send mail by smtplib module'''
# me == my email address
# you == recipient's email address
me = "[email protected]"
you = "[email protected],[email protected]"
content = 'msg detail'
server = smtplib.SMTP('server_address',25)
server.starttls()
server.login(username,passwd)
#msg = MIMEText(content,'html')
msg = MIMEText(content,'plain')
msg['Subject'] = 'subject'
msg['From'] = me
msg['To'] = you
server.sendmail(me, you.split(','), msg.as_string())
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment