s.login(fromwho, password) print "[+] Attempting to send email" s.sendmail(fromwho, towho, msg.as_string()) print "[+] Done!" s.quit() except: print "Error" elif main == "4": emailfile = raw_input('[?] Text file with all the emails: ') emailtosendfrom = raw_input('[?] Your email: ') msgfile = raw_input('[?] Text file with message: ') subject = raw_input('[?] Subject: ') email = open(emailfile, 'r') toaddrs = email with open(msgfile) as msg: msgbody = 'Subject: {}\n\n{}'.format(subject, msg.read()) password = raw_input('[?] Your email password: '******'smtp.gmail.com:587') server.ehlo() print "[+] Attempting to use STARTTLS" server.starttls() server.login(emailtosendfrom,password) print "[+] Attempting to send email" with open(emailfile) as f: emailsort = f.readlines() for user in emailsort: server.sendmail(emailtosendfrom, user, msgbody) print "[+] Done!" f.close()