Reply to Apple Mail Message

Summary: Creates a window in Mailsmith to reply to the current Apple Mail message.
Requires: Mailsmith 1.5, Apple Mail (tested with 10.2.3)
Last Modified: 2019-10-02

Description

I use Apple Mail for my mailing list mail, since it handles large volumes of mail better than Mailsmith. However, Apple Mail’s mail composition interface is terrible, so I wrote this script to let me do my replies in Mailsmith.

Note that if the script addresses the message wrong, you can look in the message’s notes field to find the headers from the original Apple Mail message.

You can run the script from either Mailsmith or Apple Mail. You’ll want to adjust the part of the script that sets the sending account and signature.

Installation Instructions · Download in Compiled Format · Download in Text Format

Script

tell application "Mail"
    
set theMessages to the selection
    
set m to item 1 of theMessages
    
set theHeaders to m's headers
    
set theDate to m's date sent
    
set theSender to m's sender
    
set theSubject to m's subject
    
set theBody to m's content
    
set theTo to address of m's last to recipient
end tell

tell application "Mailsmith"
    
activate
    
set theAttribution to "On " & theDate & " " & theSender & " wrote: " & return & return
    
    
if theSubject does not start with "Re:" then
        
set theSubject to "Re: " & theSubject
    
end if
    
    
make new message window with properties {subject:theSubject, contents:theBody, sending account:"C-Command", signature:"C-Command"}
    
make new cc_recipient at end of message window 1 with properties {address:theSender}
    
make new to_recipient at end of message window 1 with properties {address:theTo}
    
tell text of message window 1
        
replace (ASCII character 10) using return options {starting at top:true}
        
increment quote level quote string "> "
    
end tell
    
    
set text of message window 1 to theAttribution & (text of message window 1)
    
set text 2 of message window 1 to theHeaders -- stash headers in Notes field
    
    
-- doesn't work; seems to be a bug in Mailsmith
    
tell text 2 of message window 1
        
replace (ASCII character 10) using return options {starting at top:true}
    
end tell
    
    
-- force refresh to avoid UI glitch
    
set message window 1's show tool bar to false
    
set message window 1's show tool bar to true
    
    
-- scroll to top
    
select insertion point before first character of message window 1
end tell