7

One of my favorite features back when I used Outlook was the option to save sent emails in the same folder as the message being replied to. For example, if I had moved a message to folder A and was replying to that, my reply was saved in A, not Sent. (If I replied to a message in my Inbox, my reply went to the default Sent folder.)

This made it really easy to see an entire thread when I came back to it later. This workflow is a huge time-saver for me and is the only thing I miss from Outlook. Right now, I manually move sent messages to the folder with related messages which is tedious. Is there a way to recreate this feature from Outlook with Mac Mail? (I'm using Mac Mail 6.2 on OSX 10.8.2).

3
  • I was wondering if you have had a chance to take a look at my answer below. I managed to mimic the Outlook feature you miss with AppleScript and Services. Please let me know if it works for you.
    – jaume
    Mar 20, 2013 at 18:46
  • Hi, jaume. I haven't had a chance to try it yet although I appreciate the time you put into such a thorough answer. I have since discovered the "Show related messages" button in the Mail toolbar. Although this doesn't solve the original problem I stated, it does make Mail act a bit like GMail where related messages (i.e. the same thread) are all shown together no matter what folder they are in. This seems to be a viable workaround for now.
    – DaveBurns
    Mar 26, 2013 at 1:42
  • I'm happy you found a workaround. If you ever miss the "reply and move to folder" functionality and try my answer below, please post whether it worked for you.
    – jaume
    Apr 2, 2013 at 10:05

1 Answer 1

5

Mail can be extended to mimic pretty closely the feature you mention from Outlook.

OS X provides a feature called services that can be used to extend the functionality of an application (see http://www.macosxautomation.com/services/learn/index.html for more information).

I will use Automator and AppleScript to create a service that moves sent messages to the folder of the message being replied to, and then assign the standard reply keyboard shortcut (R) to the service:

  • Close Mail.

  • Open Automator in folder Applications and choose Service:

enter image description here

  • Select Utilities under Library and drag Run AppleScript to the empty pane on the right:

enter image description here

  • Configure the service to receive no input in Mail:

enter image description here

  • Replace the contents of the Run AppleScript action with:

     on run {input, parameters}
    
     tell application "Mail"
         try
             (* Get selected messages or exit *)
             set messageSelection to selection
             set selectedMessage to item 1 of messageSelection
             set replyMessage to reply selectedMessage opening window yes
             set messageID to message id of selectedMessage
             set currentMailbox to mailbox of selectedMessage
         on error
             return
         end try
         repeat
             (* Wait until reply message is sent *)
             delay 2
             try
                 if replyMessage is not visible then exit repeat
             on error
                 exit repeat
             end try
         end repeat
         synchronize with (account of currentMailbox)
         (* Wait while reply message is being sent *)
         delay 10
         (* Loop over all sent messages *)
         set sentMailbox to sent mailbox of application "Mail"
         set allSentMessages to messages of sentMailbox
         repeat with sentMessage in allSentMessages
             if source of sentMessage contains messageID then
                 set mailbox of sentMessage to currentMailbox
                 return
             end if
         end repeat
     end tell
    
     return input
     end run
    
  • Save with a descriptive name like Reply and Move Sent Message to Current Folder. The service will be saved to ~/Library/Services/. This is what the service looks like:

enter image description here

  • Open System Preferences, select the Keyboard preference pane and then the Keyboard Shortcuts tab.

  • Select Application Shortcuts, press the + button and change for application Mail the shortcut assigned to menu item Reply to R. We change it to avoid conflicts when assigning R to the service below:

enter image description here

  • Select Services, scroll down to the service you previously added and set the keyboard shortcut to R:

enter image description here

  • Open Mail. Notice that Reply's shortcut is no longer R, but R:

enter image description here

  • Also notice that there is a new service, accessible with R:

enter image description here

  • Now select a message in a folder, press R, type your reply and send it, in a few seconds you should see the sent message appear in the folder.

Changing the service to "Reply All":

Olivier has asked in a comment how to expand the Automator Service to reply to the sender and other recipients:

  1. If you are using a recent version of macOS, choose "Quick Action" in Automator.

  2. Replace the following line in the AppleScript above:

    set replyMessage to reply selectedMessage opening window yes
    

    with:

    set replyMessage to reply selectedMessage opening window yes reply to all yes
    
  3. Change the application shortcut for "Reply All" (shiftcommandR) to something like shiftoptioncommandR and bind shiftcommandR to the service.

The script has some limitations and side effects:

  • The service can't tell canceled and sent messages apart. So, if you press R and then change your mind and close the window, the service will continue executing and check your Sent folder for matching IDs.

  • AppleScript doesn't offer any means of getting a list of replies to a message. My workaround is to get the message id of the message being replied to and search it in the sent messages.

  • The sent message can't be moved while being downloaded. AppleScript doesn't return any error message if that's the case, so I added a 10-second delay. A 5-second delay was not reliable in my tests, adapt it to your needs if necessary.

  • While the service searches the Sent folder, Mail slows down.

7
  • Sorry if my question was not clear. I already have Mail grouping messages by conversation. Let me see if this helps: when I have a thread in a folder and I reply to the thread, I want my reply to go in the same folder, NOT the Sent folder. That way, my reply shows up in the thread as well - not just everyone else's replies to the thread. Does that make sense?
    – DaveBurns
    Jan 24, 2013 at 14:58
  • You are already using conversations, don't you see your own replies along with other people's replies? Anyway, if conversations isn't exactly what you are looking for I haven't found any way (I checked Preferences>Rules) to automatically move sent messages to the folder the original message was located...
    – jaume
    Jan 24, 2013 at 15:40
  • No, my replies don't get added to the conversation as a separate item. If someone else replies, there is link at the bottom of their email that says "See More from Dave Burns". Clicking on that does show my response. But what I want is the actual email that I sent put in the same folder.
    – DaveBurns
    Jan 24, 2013 at 19:39
  • 1
    @Olivier I'm glad you found my 9-year-old answer useful! Could you try changing set replyMessage to reply selectedMessage opening window yes to set replyMessage to reply selectedMessage opening window yes reply to all yes. You will probably want to change the application shortcut for "Reply All" (<shift><command>R) to something like <shift><option><command>R and bind <shift><command>R to the service, too.
    – jaume
    Feb 25, 2022 at 11:48
  • 1
    @jaume amazing, yes it works perfectly fine! Thank you so much. For those reading this and wanting to apply to Monterey, instead of "services" you should set up in Automator a "Quick Action". All other steps are identical. Such an incredibly useful little script that avoids me 1,000 daily paper cuts.
    – Olivier
    Feb 25, 2022 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .