Created
October 2, 2016 02:23
-
-
Save AbhinavMadahar/c37b8153068a777e1346c9733586f709 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import modules needed to send emails | |
import smtplib | |
from getpass import getpass | |
# sends a message to the recipient_email | |
def send(recipient_email, message): | |
if not ("@" in recipient_email): | |
raise Exception("Must have an @ in an email address") | |
try: | |
password = getpass("What's your password?") | |
server = smtplib.SMTP('smtp.gmail.com:587') | |
server.ehlo() | |
server.starttls() | |
server.login(organizer_email, password) | |
server.sendmail(organizer_email, recipient_email, message) | |
server.quit() | |
print("Sent") | |
except: | |
print("Wrong password") | |
send(recipient, message) | |
# takes some info and stuffs it into an email template | |
def body(person, company): | |
body = "" | |
body += "Hi " + person + "!,\n\n" | |
body += "I'm " + organizer_name + ", an organizer for hackMHS III, the second largest high " | |
body += "school hackathon in New Jersey! In a hackathon, students can learn how to program " | |
body += "and have some friendly competition. We plan on having over 100 hackers attend this " | |
body += "Dec 3rd in a 12-hour hackathon, and we would love it if " + company + " sponsored us!" | |
body += " Basically, " + company + " would donate some money in exchange for advertizing in " | |
body += "front of over a hundred high schoolers in one of the richest towns in America for 12 " | |
body += "hours. We use the money to provide an amazing experience and " + company + " uses " | |
body += "the advertizing to get more customers. More info can be found on our website, " | |
body += "millburnhacks.com/hackmhs/iii/sponsors.\n\n" | |
body += "If you're interested, I'd love to talk about a sponsorship deal.\n\n" | |
body += "Thanks,\n" | |
body += organizer_name | |
return body | |
organizer_name = "" or input("What is your name? ") | |
organizer_email = "" or input("What is your email? ") | |
while True: | |
print("") | |
print("Now emailing a new company") | |
email = input("What's the company representative's email? ") | |
name = input("What's the person's name? ") | |
company = input("What's their company's name? ") | |
send(email, body(name, company)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment