Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At the company I work with, we use [] prefixes before the actual subject line of emails as kind of a rough tagging system.

Is there any way that one could automate this so when I start writing a new email to, the subject will be pre-populated by []?

share|improve this question
That's not too easy (like, triggering automatically). I'd say it's pretty easy though to set up an Automator action that allows you to pre-populate a "new message" field. Would that be working for you? – slhck Feb 9 '12 at 8:17
What happens when the client gets rid of this junk when replying to that email? – Daniel Beck Feb 9 '12 at 8:28
What I meant to say is, wouldn't it be better if you just created Smart Folders, one per client, and used the To/From email address as criterion? – Daniel Beck Feb 9 '12 at 13:04
up vote 2 down vote accepted

A quick and dirty AppleScript attempt to achieve what you want, but it certainly can be improved, i.e. being bound to Automator actions, based on selection from selected items in your address book.

To use this, open "AppleScript Editor" (it's in /Applications/Utilities/, or use Spotlight), paste the following as the text body and click "run". If it's OK, you can save the script and later run it by clicking on it.

   set recipientList to display dialog "Enter the email address:" default answer ""       
   tell application "Mail"
        set composeMessage to make new outgoing message at beginning with properties {visible:true}

        tell composeMessage
            set recipientList to (text returned of recipientList)
            make new to recipient at end of to recipients with properties {address:recipientList}
            set AppleScript's text item delimiters to "@"
            set domain to text item 2 of recipientList
            set subject to "[" & domain & "]"
        end tell
    end tell

Of course, this can be improved upon.

Also, you should know, as pointed out by Daniel Beck that the recipient is free to remove that field; it's best to rely on hidden mail headers. But given you already have the domain, this info is safely stored in the email recipient.

share|improve this answer
I'd move the display dialog to the first line. That way, the user can still cancel without mail being focused, Spaces being switched, and the new mail window created. – Daniel Beck Feb 9 '12 at 12:19
@DanielBeck: Good point. Edited. – Karolos Feb 9 '12 at 12:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.