So i've been searching around for a way to do the following, sequentially in Mail.app, using AppleScript:
- intercept an outgoing message (let's call this "A")
- make and exact duplicate message (let's call this "B") of the outgoing message "A"
- format the text/content etc of this newly made message ("B")
- send this newly formatted message ("B")
- disregard the original one ("A").
Why would i want to do something that appears to be so retarded?
- Apple's Mail.app amazingly doesn't format the outgoing content of your messages.
- By doing the basic Message > Preference > etc etc it only changes the font-style of the message that you see through Mail.app. When your recipient gets the message, the font chosen is that of the client's default (which can be an abhorring Times New Roman for clients like Outlook).
So why not just ask for an Applescript that formats your outgoing message directly?
- (Now we're on to something... )
- Apple doesn't allow us to get hold of the current outgoing message as an object, which is silly.
- Apple does however allow us to get hold of a "newly made message" (via make new outgoing message) with an object
Still learning the ropes with Applescript, so would greatly appreciate it if anyone could cook up an AppleScript that does the requested.
My intention is to trigger the Applescript when i hit "Send Message" (through the lovely Keyboard Maestro).
Here's the skeleton applescript code i could come up with:
set theFont to "Lucida Sans, Lucida Sans Unicode, Lucida Grande, Verdana, Arial"
set theSize to 12
tell application "Mail"
-- 1. intercept an outgoing message
set outMsg to front outgoing message
-- 2. make and exact duplicate of this outgoing message
-- need a little help with extracting...
set fmtMsg to make new outgoing message with properties
{ sender:,
subject:”Convert”,
content:”Please convert and send”
message signature:,
to recipient:,
cc recipient:,
bcc recipient:
}
tell fmtMsg
-- 3. format the text/content etc of this newly made message
set font of content to theFont
set size of content to (theSize)
-- set visible to true
-- 4. send this newly formatted message
send
-- 5. disregard the original one.
-- help?
end tell
end tell
Cheers.