Skip to content

Instantly share code, notes, and snippets.

@richardsonlima
Last active November 28, 2016 22:00
Show Gist options
  • Save richardsonlima/35ec2175ef78ccfed24b1395c47ae5cd to your computer and use it in GitHub Desktop.
Save richardsonlima/35ec2175ef78ccfed24b1395c47ae5cd to your computer and use it in GitHub Desktop.
import smtplib
import os
from email.MIMEText import MIMEText
fromaddr = '[email protected]'
toaddrs = '[email protected]'
from email.mime.multipart import MIMEMultipart
msg = MIMEMultipart()
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'
msg['Subject'] = '[ Attention ] Email Flood Alert'
fp = open('/opt/zimbra/richardson-tricks/body.txt', 'r')
msg.attach(MIMEText(fp.read()))
fp.close()
#fp = open('/tmp/topMailsender-top15.log', 'r')
#msg.attach(MIMEText(fp.read()))
#fp.close()
# Credentials
password = 'SENHA'
# The actual mail send
server = smtplib.SMTP('server.mail.com:587')
server.starttls()
server.login(fromaddr,password)
server.sendmail(fromaddr, toaddrs, msg.as_string())
server.quit()
print "done!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment