Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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).

share|improve this question
    
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 '13 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 '13 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 '13 at 10:05
add comment

1 Answer 1

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.

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.

share|improve this answer
    
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 '13 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 '13 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 '13 at 19:39
    
The functionality you are looking for can be achieved using AppleScript and Services. I've completely rewritten the answer, please have a look and let me know whether it works for you. –  jaume Jan 31 '13 at 8:35
add comment

Your Answer

 
discard

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.