tell application "Mail" try set theSourceMsg to outgoing message 1 set keepGoing to true on error set keepGoing to false display dialog "Please create a new message containing the recipients and subject before running this script." with icon 1 buttons "OK" default button 1 end try if keepGoing and ((count of to recipients of theSourceMsg) + (count of cc recipients of theSourceMsg) + (count of bcc recipients of theSourceMsg) = 0) then display dialog "Please enter the recipients before running this script." with icon 1 buttons "OK" default button 1 set keepGoing to false end if if keepGoing then tell application "System Events" to set useSafari to (process "Safari" exists) if useSafari then tell application "Safari" to set useSafari to (count of (windows whose visible is true and name is not "Downloads")) > 0 if useSafari then display dialog "Please choose the source for your HTML message" buttons {"Front window in Safari", "Choose FileÉ"} set useSafari to button returned of the result = "Front window in Safari" end if if not useSafari then try set theFileLocation to choose file with prompt "Please choose and HTML file to be sent:" on error set keepGoing to false end try end if if keepGoing then try set theSender to sender of theSourceMsg set theSubject to subject of theSourceMsg set theMsg to make new outgoing message with properties {sender:theSender, subject:theSubject, visible:false} tell theMsg repeat with eachRecipient in to recipients of theSourceMsg set theName to name of eachRecipient set theAddress to address of eachRecipient make new to recipient at end of to recipients with properties {name:theName, address:theAddress} end repeat repeat with eachRecipient in cc recipients of theSourceMsg set theName to name of eachRecipient set theAddress to address of eachRecipient make new cc recipient at end of cc recipients with properties {name:theName, address:theAddress} end repeat repeat with eachRecipient in bcc recipients of theSourceMsg set theName to name of eachRecipient set theAddress to address of eachRecipient make new bcc recipient at end of bcc recipients with properties {name:theName, address:theAddress} end repeat if useSafari then tell application "Safari" to set theHTMLContent to source of document of window 1 else set theFile to open for access theFileLocation without write permission set theHTMLContent to read theFile from 1 to (get eof theFile) close access theFileLocation end if set html content to theHTMLContent end tell send theMsg delete theSourceMsg on error delete theMsg display dialog "Failed to generate HTML message." with icon 1 buttons "OK" default button 1 end try end if end if end tell