Skip to content

Instantly share code, notes, and snippets.

@lyoshenka
Last active August 29, 2015 14:04
Show Gist options
  • Save lyoshenka/3b400eb29effae80b64d to your computer and use it in GitHub Desktop.
Save lyoshenka/3b400eb29effae80b64d to your computer and use it in GitHub Desktop.
Sends an email to your account that you want Gmail to check more frequently. Run this in cron for a week or two.
#!/usr/bin/env python
# for crontab
# */5 9-22 * * * /home/grin/bin/cronic /usr/bin/python /home/grin/email-ping.py
# */15 23,0-8 * * * /home/grin/bin/cronic /usr/bin/python /home/grin/email-ping.py
import smtplib, time, sys
from email.mime.text import MIMEText
from_email = ''
password = ''
s = smtplib.SMTP('smtp.gmail.com:587')
s.ehlo()
s.starttls()
s.login(from_email, password)
msg = MIMEText("This should make gmail check your account more frequently. Ignore these emails.\nserver status: OK")
msg['Subject'] = 'Make a filter to ignore these messages. Server status '+time.ctime()
msg['From'] = from_email
to_list = []
for to in to_list:
msg['To'] = to
print msg.as_string()
s.sendmail(from_email, [to], msg.as_string())
s.quit()
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment