Skip to content

Instantly share code, notes, and snippets.

@renjithsraj
Last active September 23, 2016 07:08
Show Gist options
  • Save renjithsraj/b16dd135929d2bc94f4e1375bc019f72 to your computer and use it in GitHub Desktop.
Save renjithsraj/b16dd135929d2bc94f4e1375bc019f72 to your computer and use it in GitHub Desktop.
from threading import Thread
import requests ## pip install requests
import time
import smtplib
## email sending function
def email_sender(input_message, email_to):
''' function to send email '''
to = email_to
gmail_user = 'your email'
gmail_pwd = 'email password'
smtpserver = smtplib.SMTP("smtp.gmail.com",587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject:site down! \n'
input_message = input_message
msg = header + input_message
smtpserver.sendmail(gmail_user, to, msg)
smtpserver.close()
a = email_sender("hello","renjith.r@tringapps.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment