If you are wondering what we are talking about, click here to read the back story. Then come here and do it the easier way
So I took my own advice and tried to find a way to send mail from the command line. This way the mail.app doesn’t keep flicking to the forefront every few hundred seconds. That was getting old quickly. It turns out it wasn’t very difficult. From what I have read, different people may have a different experience due to their isp’s policies on sending mail and how google reacts, but I digress…
This one is simple!
It is two terminal scripts, a text file, and a loop in automator. DONE!
Update! After reading the theory on this page you should go to this page to find a simpler, better solution.
Ok this hack might not be for everyone, but if you have Gmail set up to check your pop accounts they don’t let you set the polling frequency anywhere. This can be bad because it makes you go to the settings page to be able to hit the refresh button on each one of your accounts! After a little digging it turns out it uses a weird formula to determine the polling frequency. Let’s say it checks your account and finds an email. The next time it checks it will wait for _slightly less time_ before it checks again. If it finds email a second time it will continue to shorten the interval until it is checking every 5 minutes or so (maybe even less!) The purpose of this is so that google doesn’t waste resources checking an account that only gets one email a month.
The downside of this approach is that if you are eagerly waiting for that one email you might be waiting for a long time (i have seen wait times up to 58 minutes!)
The answer is very simple once you know how it works – get more email! I didn’t want to test to see if the spam filter counts spam received as real mail. I doubt that it does. So I did the next best thing – I automated sending myself email!
I have thought of two different ways of doing this both are mac only, but there must be a billion ways to skin this cat!
My last project, the arduino gmail checker really opened my eyes to python/rss/arduino integration. I branched out from there to use feedparser for more conventional rss reading and I ended up with a python script that pulls in your friend updates from facebook. That was cool watching it scroll by in terminal, but I decided to geek it up a bit and make it display out through a serial lcd. Nothing is more distracting than a lcd flickering constantly at your desk!
Here’s a pic of it doing it’s thing.
Here’s how I did it.
I’ve been really interested in doing J4mie’s Physical Gmail Notifier ever since it came out in February. I only recently dropped into the project and got to learn a lot about python, plists, and arduino auto-reset functionality. I’m going to share what I’ve learned because I think there are lots of other people out there struggling to make it work. This page doesn’t really offer much that J4mie didn’t already say – it just says it in a different way.
I’ll post the code below – one issue with the way J4mie posted his was that it appended line numbers to everything and messed with formatting. Python is _really_ picky about formatting! All of the files are zipped HERE. It consists of three documents –
1) one python script that logs into your gmail rss feed and checks your total number of new messages. It then sends either an ‘m’ or an ‘n’ to the serial port.
2) one arduino sketch that tells the arduino to turn on or off a light based on the serial input
3) one .plist file that tells your mac (sorry pcs!) to run the python script every 60 seconds. If you run windows or linux then I’m sure there is something you can do to schedule this. You could also just set it to loop until quit. (to quit a script in terminal hit control-c)