A Note on Setting the Sender of a Mail Message

Just a note on setting the sender of a mail message, for those of us with multiple email accounts. Hope some people might find it of interest.

It used to be impossible to set the sender of a new mail message in AppleScript. Instead, I used a complicated GUI script that clicked the sender field and typed the beginning of the address I wanted. (I have quite a few.)

Upgrading to 10.11 seems to have killed that, but It was pretty fragile anyway. I overrode ⌘N to invoke a set of KM macros, using the conflict palette to pick the one I wanted. The main point was to force me to choose, rather than accidentally sending from the wrong address.

Two things changed that make it possible for me to abandon the GUI script solution (though not the use of a conflict palette) and use a much simpler approach:

  1. I can use the beautiful KM Send Mail action (which I use with And Save Open, rather than And Send, and filling only the sender field).

  2. To my surprise, it is now possible to set the sender of a message via AppleScript: set the sender of theMessage to "sender address"

Hey Mitchell,

This has been true for over a decade – BUT only with messages created with AppleScript.

Once the message is created you can't touch it again. (BAD Apple!)

-Chris

Maybe the was my confusion – I had some macros that created a new mail message then put a menu of sender addresses for me to choose from. A new AppleScript I was working on let me set the sender. Didn’t occur to me that it would have to do with whether the message was created inside or outside of AppleScript rather than a change. I remembered sender being marked read-only.

I had a second related requirement: changing the sender of a message I am editing before I send it out. And that would require GUI scripting. My GUI AppleScript was invoked by KM string trigger beginning with !@ and followed by a character to indicate which address I wanted to send from.

Long ago I decided that Apple’s Mail program just didn’t fit the bill as a scriptable email application nor did I like all the junk I saw in the email’s GUI. There was a solution to all that! At the time BareBones Sw. (Think BBEdit and TextWrangler) had among their slate of apps a program called “Mailsmith” which turned out to be exactly what I was looking for. You guys might want to take a look at it. It has moved from BBSW’s website to one of its own at Stickshift Software, LLC ( http://www.mailsmith.org/ ).

Note: Mailsmith is a text only email app, i.e. an email’s text is extracted and presented. Content such as html, photos etc. are treated as attachments but are still available if you wish to view it.