SHARE
TWEET

email py

a guest Apr 2nd, 2019 390 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from email.mime.text import MIMEText
  2. from email.mime.application import MIMEApplication
  3. from email.mime.multipart import MIMEMultipart
  4. from smtplib import SMTP
  5. import smtplib
  6. import sys
  7. import datetime
  8. def main(task , dest):
  9.     mail_user="fypgp6@gmail.com"  
  10.     mail_pass="@Bcd123456"
  11.  
  12.     #emails = dest #tmp commented
  13.     emails = 'fypgp6@gmail.com'
  14.  
  15.  
  16.     msg = MIMEMultipart()
  17.     msg['Subject'] = 'SMB Automatic Penetration Test'
  18.     msg['From'] = mail_user
  19.     msg['To'] = dest
  20.  
  21.     msg.preamble = 'Multipart massage.\n'
  22.     part = MIMEText(str(datetime.datetime.now())+" Your job " + task + " is almost finish, please login to the system again and check the result")
  23.     msg.attach(part)
  24.     try:
  25.         # server = smtplib.SMTP('smtp.office365.com',587,timeout=100)
  26.         server = smtplib.SMTP('smtp.gmail.com',587)
  27.         server.ehlo()
  28.         server.starttls()
  29.         server.login(mail_user, mail_pass)
  30.         server.sendmail(msg['From'], emails , msg.as_string())
  31.         server.quit()
  32.     except:
  33.         print '!!!err mssgg: ', sys.exc_info()
  34.         print "error : cannot send the email to user"
  35.  
  36. if __name__ == '__main__':
  37.     main("auto exploit","waiming1999@gmail.com")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top