UPDATE – MARCH 17th 2013: This bug has now been fixed (only took Apple 7-8 months to do it!), with the latest release, OS X 10.8.3. So fire up Software Update and update your Mountain Lion! No more need for the Apple Script below.
Sorry for the long subject but it’s a bit hard to explain this issue in a subject line First, let me explain the problem a little bit, but if you’re only here for the fix, scroll down to “The Solution”…
This bug/issue with Apple’s latest version of Mail, 6.0, in Mac OS 1.8 “Mountain Lion” primarily affects two kinds of users:
1) Those who use a unified mail inbox that gathers mail from multiple other accounts (such as me).
2) Those who move mail around to different mail folders on their Mac, either manually or via rules.
The problem is, once a mail has been moved away from the Inbox that is associated with the account you received the e-mail at, and you try to reply the e-mail, your “From” address is now changed to whatever address you have specified to be the one used for creating new e-mails.
This is a big problem if you use the same computer for work and home, or you are involved with several businesses. You don’t want somebody e-mailing you at firstname.lastname@example.org getting your reply from email@example.com – do you? That’s the risk you run when you use Mail 6.0 from Mountain Lion, this bug was not present in previous version of Mac OS X.
To elaborate on user #1 (how I do): I have a Gmail (well, Google Apps, but almost same difference) download e-mails from 3 other POP3 accounts, so I basically have e-mails from 4 different accounts in the same Gmail account. This makes it very easy for me to have my inbox synced across all devices.
On my Mac, before Mountain Lion, I could reply to any email sent to my company work e-mail, and my company work e-mail would be listed as “From”. Perfect. Now, Mail instead picks my private e-mail address (the one I have selected as default for new messages) to use as “From”, even though the mail was clearly addresses to a different address.
Same thing happens if you have rules that automatically put any mail with subject “[Project 123]” into a “Project 123″-folder, and you later decide to reply it, your reply will be sent from your private address and not the address the mail was sent to. Even if you manually move the mail to that particular folder.
More information/threads about this bug:
- Apple discussions: Mail bug in Mountain Lion
- Apple discussions: How can I configure Mail in Mountain Lion to default the “from” field to match the account indicated by the “to” field of the message being replied to?
- Mountain Lion Mail Perturbs Sending Behavior
- Bugs & Fixes: Troubleshooting Mountain Lion
The Solution: AppleScript
After having sent enough e-mails from the wrong “From” address, I got tired of it and went searching for a (temporary) fix, and I found this post by Robert Silverstein on the Apple Discussion boards. His script had two problems, though:
1) It required a 3rd party app to actually run the AppleScript, in this case, “Spark”.
2) It would set the recipient e-mail as “From”, but only the e-mail address. This means your e-mails will now appear as being from “firstname.lastname@example.org”, ie. without your name shown, instead of the usual e-mail format being “Firstname Lastname <email@example.com>” or something like that. This means that recipients would no longer see my name when I e-mail them, but only my e-mail address.
I fixed both problems, so a big thanks to Robert for supplying his script that I have used to modify to my needs:
1) Launch Automator on your Mac. Easiest to invoke Spotlight and search for Automator. Once in Automator, create a new “Service”:
2) In the left column, search for “applescript” and drag the result to the right column, so it will look like this:
3) Remove all the default scripting from the Automator AppleScript window, and copy/paste the below AppleScript, so it looks like this (script below picture):
AppleScript to copy/paste is below – MAKE SURE that you insert your e-mail addresses in the “if SentTo = ” line in the middle. This script is made for 3 e-mail addresses, if you have less or more than that, modify accordingly, it should be pretty straightforward. Finally, this script assumes that you use the same “name/email” format for your different e-mail accounts, like “Firstname Lastname <firstname.lastname@example.org>”. If you use “Firstname – Company <email@example.com>” instead, you need to modify the “set sender of theResult” line accordingly.
To see the format you are using, create a new message in Mail and look in the “From” drop-down box below the Subject box.
property sentTo : "" property theResult : "" tell application "Mail" activate set theSelection to selection if ((count of theSelection) = 1) then tell item 1 of theSelection set sentTo to (address of recipient 1 of item 1) set messageID to id of item 1 set theResult to (reply item 1 with opening window) if sentTo = "firstname.lastname@example.org" or sentTo = "email@example.com" or sentTo = "firstname.lastname@example.org" then set sender of theResult to "Firstname Lastname <" & sentTo & ">" end if end tell else display dialog ("Error: Select a message before running this script, or multiple recipients in selected message.") end if end tell
You can use the “Compile” button to make sure there are no errors in the script and to add the nice colors
4) At the very top of the Automator window where it says something along the lines of “Service receives…”, make sure you select “no input” and also make sure you select “Mail” in the drop-down box next to it:
From now, you can also test the script. Select a message in Mail 6.0, switch to Automator and click the “Play” button and see what happens – it should: Open up a reply message window, and have pre-selected the correct “From” address, basically, work like it used to do before Mountain Lion. If it does not, see if it throws an error and try to fix it.
5) Now you need to save your AppleScript as a service. Just hit CMD+S and it will ask for a name, make sure you can remember the name, or write it down somewhere (you need it later). I called mine for “Mail reply-from as recipient”, but anything will do, as long as it’s not something that another menu item is already using in Mail, so “Reply” will not work, etc.
6) It’s time to make it easy to use the script by assigning it a shortcut. I went with CMD+R, which means that the default “Reply” function in Mail no longer uses CMD+R, instead, that shortcut is assigned to my service, which basically does the same thing as the original “Reply”, except for two things:
- It does not have the “reply-from” bug. Yay!
- It does not have the nice eye-candy animation where a message pops up and turns into a new message window. Instead, with this script, your reply window will just popup instantly. Bummer (but I’ll live).
7) With the AppleScript saved through Automator as a Service, you should be able to switch to Mail 6.0, hit the “Mail” menu, expand “Services” and your service should be visible there:
Note that it also shows your assigned shortcut, in this case, “CMD+R”.
That’s it, folks!
The Mail bug was not fixed in 10.8.1 as I had hoped for, which is why I decided to try and find a workaround. Hopefully it will be fixed in 10.8.2 but so far there are no reports of it. But hey, now that I’ve spent a lot of time writing this how-to article, I’m sure that with my luck, it will now be fixed in 10.8.2 which will probably also be released in a few days now, just to annoy me I wouldn’t mind that though… but for now, this at least works.
Ideas for improvement (that I’m unable to do with my limited AppleScript knowledge):
- Have the script run-through all your accounts in “sender” and automatically pick the one that matches whatever “address of recipient” is, to avoid all the “if… then” for each e-mail address you want this script to work with.
- If there are multiple recipients of an e-mail (In the “To” field), the script does not seem to work and will revert to default Mail 6.0 behavior, ie. just use your default e-mail address for new messages, when you reply. It’s possible that if your e-mail address is the first of all the “To” addresses, that it might still work as expected.
- If possible: Add the same animation when the message window pops up, as if using the original “reply” method. Eye candy is part of the experience
- Have the script send an e-mail to Apple each time you use it: “Hi Apple. Again, I had to use a custom script to fix your bugs. Wake up!!”.