-- Downloaded From: http://c-command.com/scripts/mailsmith/reply-to-mail-message -- Last Modified: 2007-08-17 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