Send Entourage mails from the command line with Ruby
I've been spending a lot of time creating reports lately, and I generally live in a terminal, so naturally I started to think of ways to easily send emails with these reports attached. I'm stuck using Microsoft Entourage here at work, but thankfully they have a pretty robust AppleScript library. Mixing some stuff together I pulled together this Ruby script which will allow me to do some neat stuff:
pipe data into the email command to create a body
use aliases as groups to send emails to common groups of people, etc
add multiple attachments to emails straight from the command line!
not have to move my hands from the keyboard when sending emails!
At its core, it is nothing more than a simple ruby shell script which compiles AppleScript and uses osascript to execute the AppleScript. When run it will pop open a new Entourage mail window with the To/CC/Subject filled out, as well as any attachments and moves focus to the window. If I had piped anything to STDIN that would be the body, otherwise it would blank and ready for a quick message. Then a quick CMD-ENTER and off the mail goes. Simple and elegant, yet kind of powerful :)