Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- username = 'emailtosendnotificationfrom@gmail.com'
- password = 'passwordforemailabove'
- def initializeEmail():
- s = smtplib.SMTP('smtp.gmail.com',587)
- s.starttls()
- s.login(username,password)
- return s
- def sendEmail(s, message):
- msg = MIMEMultipart()
- msg['From'] = username
- msg['To'] = "emailtorecievenotification@gmail.com"
- msg['Subject']="NEW MARKS ARE OUT"
- msg.attach(MIMEText(message, 'plain'))
- s.send_message(msg)
- del msg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement