Created
December 3, 2013 18:37
-
-
Save andrewjkerr/7774946 to your computer and use it in GitHub Desktop.
Checks to see whether the grades for EEL4744c has been updated and emails TO@GMAIL.COM if it has :)
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
require 'net/http' | |
require 'net/smtp' | |
file = File.open("grades_current.html", "rb") | |
cur_source = file.read | |
message = <<MESSAGE_END | |
From: Andrew Kerr Updates <updates@andrewjkerr.com> | |
To: MicroP Peeps <microp@lists.ufl.edu> | |
Subject: MicroP Grades Updated! | |
The grades for Microprocessors have been updated! http://www.add.ece.ufl.edu/4744/grades.html | |
MESSAGE_END | |
updated = false | |
source = Net::HTTP.get('www.add.ece.ufl.edu', '/4744/grades.html') | |
while !updated | |
if cur_source != source | |
smtp = Net::SMTP.new 'smtp.gmail.com', 587 | |
smtp.enable_starttls | |
smtp.start('gmail.com', 'GMAIL_EMAIL@GMAIL.COM', 'GMAIL_PASSWORD', :login) | |
smtp.send_message message, 'FROM@GMAIL.COM', 'TO@GMAIL.COM' | |
smtp.finish | |
updated = 1 | |
end | |
sleep 600 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice!