I am a newbie to scripting and would appreciate some help. I am looking to create a script that will automatically insert a background image in emails I am creating in Entourage. For some reason they don’t allow an email template or an assignment of an image as a deafult when you hit compose.
Any help would be greatly appreciated.
Thanks,
DA
This works for me (change the bgImag path to match a real image in your disk):
set bgImg to alias "path:to:file.jpg"
set msgContents to "Date: " & (do shell script "date '+%a, %e %b %Y %H:%M:%S %z'") & "
Subject: <no subject>
Mime-version: 1.0
Content-type: multipart/related;
boundary=\"xxxxxxxxxx\"
> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--xxxxxxxxxx
Content-type: multipart/alternative;
boundary=\"yyyyyyyyyy\"
--yyyyyyyyyy
Content-type: text/plain;
charset=\"US-ASCII\"
Content-transfer-encoding: 7bit
--yyyyyyyyyy
Content-type: text/html;
charset=\"US-ASCII\"
Content-transfer-encoding: quoted-printable
<HTML>
<HEAD>
</HEAD>
<BODY background=3D\"cid:myImg\">
</BODY>
</HTML>
--yyyyyyyyyy--
--xxxxxxxxxx
Content-Type: image/jpeg; name=\"image.jpg\"
Content-ID: <myImg>
Content-Transfer-Encoding: base64" & return & return & ¬
(do shell script "openssl base64 < " & quoted form of POSIX path of bgImg) & ¬
return & return & "--xxxxxxxxxx--"
tell application "Microsoft Entourage"
make new outgoing message at drafts folder with properties {has html:true, source:msgContents}
open result
end tell
Note that it will be saved at drafts folder by default (so, you must delete it manually if you don’t like it)