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