tags:

views:

10

answers:

1

To help my users report problems easily, I want to create as much of an email as possible. Most importantly, I want to attach a file (the log file).

How can I do this in AppleScript?

+1  A: 
tell application "Mail"
    set theMessage to make new outgoing message with properties {visible:true, subject:"My Subject", content:"My Body"}
    tell theMessage
        make new to recipient at end of to recipients with properties {name:"Ben Waldie", address:"[email protected]"}
    end tell
    tell content of theMessage
        make new attachment with properties {file name:pathToFile} at after last paragraph
    end tell
end tell
Philip Regan
Thanks, that did the trick. I had to make a small change - make new to recipient didn't work in "tell content of theMessage" block"
Steve McLeod
Sorry about that and thanks for fixing it. It's still early and I was in a rush.
Philip Regan