NotesToSelf

NotesToSelf

DK  //  Factoids and occasional bits of useful information.

Jun 13 / 1:20pm

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

Aug 06, 2009
Robynerin said...
Could you please detail the steps you took to accomplish this feat? I love this functionality and admire your clever problem-solving abilities. However, my technological knowledge is too limited to recreated such an effect myself. Like you, I highly value this kind of emailing precision. But, unlike you, my skills are sorely lacking. Anyway, if you could provide some more insight, I would greatly appreciate it, as you are the only one I have found discussing this glitch with Automator and offering solutions.

Thank you in advance!

Aug 06, 2009
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.

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    Connect    twitter