0

When I use AppleScript to make a new outgoing message in Mail.app, the message is always being set to rich text (which is a bit confusing as I have the app setup to use plain text by default.)

Script:

tell application "Mail"
    set newMessage to make new outgoing message
    tell newMessage
        set subject to "sub"
        set content to "body here" & return & return
        make new attachment with properties {file name:"/tmp/picture.jpg"} at after the last word of the last paragraph
        set sender to "foo@example.com"
        set visible to true
    end tell
    activate
end tell
delay 0.9
tell application "System Events" to keystroke "t" using {command down, shift down}

Is there a clean way to set the message to be plain text? I seem to be missing something with DefaultMessageFormat.

Currently I use hacky keystroke seen above.

Note: the 0.9s delay is there because if I don't use this on Mojave (dark mode), the message will show dark grey text on a dark grey background :-(

Jonathan Cross
  • 675
  • 8
  • 17
  • 1
    Does this answer your question? [Using AppleScript to set a mail message to Plain Text](https://stackoverflow.com/questions/12162392/using-applescript-to-set-a-mail-message-to-plain-text) – Matts Feb 11 '20 at 03:00
  • Yes, it does with one small tweak, thanks! I submitted an [update to that answer](https://stackoverflow.com/review/suggested-edits/25330425). – Jonathan Cross Feb 12 '20 at 00:55

0 Answers0