I just noticed this isn't working on 10.11.1.
-------------------------------------------------------------------------------------------
# Auth: Mark Munro (Macscripter)
# dCre: 2013/08/04 01:09
# dMod: 2015/11/26 19:48
# Appl: Mail
# Task: Make new HTML email!
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @New, @Message, @HTML, @Content
-------------------------------------------------------------------------------------------
set textBody to "<HTML>
<BODY bgcolor=\"#99CCFF\">
<H1>Hi There</H1>
<p>This is very minimal <u>\"hello world\"</u> HTML document.</p>
</BODY>
</HTML>"
set textSubject to "HTML Test"
set toName to "Me"
mailMessageCreate(toName, toAddress, textSubject, textBody)
on mailMessageCreate(toName, toAddress, textSubject, textBody)
tell application "Mail"
activate
set refMessage to make new outgoing message with properties {subject:textSubject, visible:true} -- visible MUST be false to work
tell refMessage
set html content to textBody -- must set the _HTML CONTENT_ rather than the _CONTENT_
make new to recipient at end of to recipients with properties {name:toName, address:toAddress}
send
end tell
end tell
end mailMessageCreate
-------------------------------------------------------------------------------------------
It seems to me Shane presented an ASObjC method of doing this a while back.
Still causing Script Debugger to hang but working from Script Editor.
NOT working from Keyboard Maestro though, damn it...
DOES work from FastScripts.