Filed under: Software, Features, Cool tools, Productivity, Internet Tools
TUAW Automator Action: Mail Man - attach to email and automatically send
A while ago I had to help the TV Squad crew cover an award ceremony by snapping screenshots with my Eye TV. I needed a way to fire these shots off to members of the team with the least amount of effort, so I put together a few Automator droplets that could take whatever files I drop on them, attach them to a Mail.app message and automatically send them to pre-determined recipients with no questions asked. At the time I didn't think too much of the actions, so they got busy with collecting dust on my backup hard drive, waiting for a time when they might be called back into action. Well, this similar hint at macosxhints.com was just that time, as it inspired me to bring these actions out of mothballs. That hint seems a little overly complex to me, what with the scripts and the editing and creating folders and attaching - oh my! I figured this Automator action might be a little easier to deal with, so here you go. I call it Mail Man, and we're hosting it on TUAW. Here's how it works.First, in the zip file we're providing, there are two files: one is a .workflow file which is ripe for opening and editing in Automator, and the other is a .app saved from the workflow, which you can simply drag and drop onto Automator in the dock to open and edit as well (I just wanted to cover all the bases). No matter which file you open for editing, you'll see there are three actions that make Mail Man tick. The only one you need to really care about is the second action, 'New Mail Message,' and there are a couple of ways you can make it work, depending on how you roll.
First, if you twirl down the Options arrow, you'll see that 'Show Action When Run' is not checked; this means that if you fill in at least one recipient (as I have for demonstration purposes), Mail Man will simply open a new message, attach the files and send the message, with no further effort on your part. However, if you would like some on-the-fly control over who this message gets addressed to, or perhaps you would like to add a subject on a per-message basis, your second option here is to check that box. This will give you a dialog each time you run the action that looks remarkably similar to this:

Now I typically use this action as a droplet on my desktop (or from the Dock), created by choosing File > Save As... in Automator, but it works just fine as a plug-in for the Finder and Folder Actions as well. Using it this way, you could right-click files and folders in the Finder and chose Automator > Mail Man (or whatever you chose to call it), or simply attach it as a Folder Action so you can automatically email anything you drag and drop onto a specific folder.
Either way, I hope you find Mail Man useful, as it's good for all sorts of handy email work like archiving stuff in Gmail and shooting files to coworkers. Feel free to ask question in the comments, and I'll try to help.

![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 1)
Brad Proctor said 11:32AM on 1-18-2007
Here is a better explanation and example from automator.us....
http://automator.us/examples-06.html
Reply
chris holden said 11:25AM on 1-18-2007
I was using this action to back up files to my gmail account. For easy sorting and searching later on, I wanted to include the filename in the subject of the email. I wanted this to happen automatically. Does anyone know how to thusly expand this action or done anything similar?
Reply
Rob said 12:25PM on 1-18-2007
This automator workflow is NOT needed, if you want to send a file via EMAIL. Just drag the file to your MAIL icon on your dock.
It may be handy if you want to send an EMAIL to a predetermined person.
Rob
Reply
BillJJones said 12:42PM on 1-18-2007
Rob - Dragging to the Dock opens an email message that you have to fill out. These solutions are for sending quantities of messages to predetermined addresses.
Read the post.
Reply
BillJJones said 12:58PM on 1-18-2007
1.
The applescript solution prompts for subject with an included script. That might be the easiest way to get the subject in there. It doesn't do it automatically but I bet you could tweak the place where it prompts you for the subject to make it use the file name.
http://murphymac.com/slib/mailer.htm
Reply
Brian Ashe said 5:29PM on 1-18-2007
Too bad it's not easier to get Postfix (the mail server that comes with OS X) up and running. In an ideal world, the built-in mail server would be able to talk to any regular ISP's email server (behaving like a regular mail client, not like a 'real' mail server) and things like this script--a one-liner I wrote a year ago for use in OS X--would be more common. Using 'mail' from the command line is the best thing in the world. Here's a two-line script that zips the contents of whatever directory you're in and emails that zipped file to the recipient of your choice.
#!/bin/sh
# script name: ~/bin/zipnmail.sh
# to zip and email the contents of the directory you're in
# usage: 'zipnmail.sh user@host subject'
tar zcvf ~/tmp/temp.tgz ./*
(echo "See attached"; uuencode ~/tmp/temp.tgz temp.tgz) | mail -s "$2" $1
Reply
David Chartier said 5:32PM on 1-18-2007
#3: Rob, hence "automatically send" in the post's name. I agree with BillJones: read the post, but please read at least the headline too.
Reply
Rob said 8:21PM on 1-18-2007
I did read the post. Did you read the post carefully?? I think not. Despite its misleading title, this article describes TWO scenarios.
Scenario 1 - Sending EMAILS to a predetermined receipient where the user does not have to type in any details such as the subject.
Scenario 2 - Sending EMAILS where you MUST fill in more details such as the EMAIL address of the recipient or the subject etc.
Scenario 2 is described here --
"However, if you would like some on-the-fly control over who this message gets addressed to, or perhaps you would like to add a subject on a per-message basis, your second option here is to check that box."
My point is simple. This Automator workflow is a complete waste if you want to do Scenario 2. Just Drag the file(s) to the Mail icon on the Dock. This feature is already built into Mac OS X.
Rob
Reply
chris holden said 1:12AM on 1-19-2007
I was able to use Murphy's script (I like the site BTW) and alter it to make the subject automatically be the filename and I also changed it into an app so that I could drop files there instead of moving them into a folder I didn't want (as suggested in the comments on Murphy's post). The changes to the script (for beginners like me) to automatically set the subject are:
set iteminfo to info for eachitem
set theSubject to name of iteminfo
and later on in the tell message section:
set subject to theSubject.
Reply
MurphyMac said 2:18AM on 1-19-2007
Thanks Chris!
I look forward to trying your suggestion.
-Murph
Reply