Sending Gmail with Automator and Python
I wanted to automate some reminder emails I send out every week (because I always forget to send them), and thought I'd give Automator a try. The experience wasn't that great. It launches OS X's Mail application and, for whatever reason, doesn't send anything. The message just sits in the Outbox. I think it's a known bug in Automator, but it was sort of a letdown for something as simple as auto-sending email.
So instead, I adapted a short python script that sends email via the smtplib and email modules, and used Automator to run the script via an iCal plug-in (File>Save As Plugin). Creating a plugin creates an Automator calendar in iCal where your scheduled script resides. All you have to do is set the timing. I know the command-line folks probably use cron to schedule scripts like this, but I like seeing the scheduled script on my calendar. I also like the script approach because I don't have to launch any other applications (e.g., Mail). The script also works for those of you using google apps (just use your google apps email address).
2 comments
DK said...
Robynerin, I'm afraid I'd need some more specifics from you. It also occurs to me that you may not have seen the python code attached to the blog post immediately following this one. If you know some python, you should be able to adapt the script easily. If not, you may need to invest some time learning a little python to get the script up and running. Python.org offers links to tutorials, etc.



Thank you in advance!