Financial Python

Studies in Finance and Python

Posts Tagged ‘mac

Sending Gmail with Automator and Python

with one comment

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).

Mirror at NotesToSelf

Written by DK

June 13, 2009 at 8:20 pm

Posted in Python

Tagged with , ,