Sending Complex HTML emails with MAIL

Hi,
Does anyone have a script to send complex html emails with Mail?

I have a script that works with Outlook. Could someone guide me in how to change it to work with MAIL. (I don't know anything about writing scripts.)

Martha

Posted on Nov 6, 2004 12:40 PM

Reply
48 replies

Sep 13, 2005 3:00 PM in response to Andreas Amann

HI Andreas,

Thanks for the reply. Wow! That works perfectly. Cheers 🙂

However, I'm actually trying to do something a little different than send an existing HTML page to mail. I'll do my best to explain my requirements.

Using Applescript Studio, I'm writing an application that takes input from a user and passes the data into mail as a URL.

Example:
--
Job Code:
Job Title:
Designer:
Proof Number:
--

The input from this form needs to be sent to Mail as HTML:
Click here to send approval

I don't want the recipient to see the full URL, just a hyperlink saying "Click here to send approval".

My current script sends the html to mail as plain text 😟

Here is a snippet of the code that I'm working with:

-- Format Data, Launch Mail & Create Message
on processMail()
set designer to contents of popup button "designer" of window "main"
set proofNumber to title of popup button "proofNumber" of window "main"
set jobCode to contents of text field "jobCode" of window "main"
set jobCodeURL to encode_text(jobCode, true, true)
set client to contents of text field "client" of window "main"
set clientURL to encode_text(client, true, true)
set jobTitle to contents of text field "jobTitle" of window "main"
set jobTitleURL to encode_text(jobTitle, true, true)
set designerComments to contents of text view "text" of scroll view "designerComments" of window "main"
set theSender to "user@user.com"
set ccName to "Another User"
set ccAddress to "another@user.com"
set theSubject to "MBL" & jobCode & " - " & jobTitle & " for " & client & " - Proof No: " & proofNumber
set theURL to "<a href=\"http://www.michaelburbridge.com/proofs/index.php?j=" & jobCodeURL & "&c=" & clientURL & "&t=" & jobTitleURL & "&d=" & designer & "&p=" & proofNumber & "\">Click here to send approval"
set theBody to "<html><head><title>Proof from MBL</title></head><body> *********************************************************************
" & return & ¬
"Please visit the following URL to respond to the attached PDF:
" & return & ¬
theURL & return & ¬
"
*********************************************************************</body></html>"
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
tell newMessage
set visible to true
set sender to theSender
make new cc recipient at end of cc recipients with properties {name:ccName, address:ccAddress}
end tell
end tell
end processMail

--

So I guess my question is...Is there any way that I can make the above work properly or is there a more elegant way of achieving the goal?

I've just had to edit this message - it looked terrible when posted. I hope that the above makes sense and again, I really hope you can help?

Kind regards,
Gary

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Sending Complex HTML emails with MAIL

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.