Fix: Mountain Lion “Apple Mail 6.0″ problems with sender (reply-from) and mail folders/boxes

by Klaus on August 29, 2012

in Guides/How-To, Mac OS X

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 work@company.com getting your reply from private@mail.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:

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 “my@email.com”, ie. without your name shown, instead of the usual e-mail format being “Firstname Lastname <my@email.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 <email@address.com>”.  If you use “Firstname – Company <email@address.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.

AppleScript:

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 = "email1@address.com" or sentTo = "email2@address.com" or sentTo = "email3@address.com" 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:

  1. It does not have the “reply-from” bug. Yay!
  2. 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).
To assign the shortcut, open your System Preferences and go to Keyboard and Keyboard Shortcuts. Simply create a new shortcut, select “Mail” from the drop-down box, and also write the exact same name as you saved your service as, in my case, “Mail reply-from as recipient”. Finally, assign a shortcut, you can use CMD+R or maybe go with CMD+ALT+R if you like?

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 :D   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!!”. 
UPDATE (October 2012):
Stefan added two very helpful comments below, with his optimizations for the AppleScript above. Click here to read them.
UPDATE (March 2013): 
Yes, Apple has still not fixed this damn issue! Anyway, Ulf has posted another version of the script in the comments below, that you might want to check out as well, click here to read it.

Related articles you might find interesting:

Comments & Leave a Comment

comments

CommentLuv and the normal WordPress comments system has been
temporarily removed in order to cut down on comment spam!

Previous post:

Next post: