Hi guys,
I get emails from work that send mail formatted as HTML, I want to Redirect that message to another inbox called "cases@mail.com"; the problem is, the case tool we use doesn't recognise HTML, so what I'm trying to do is re-direct plaintext messages instead. My logic is as follows:
1. Receive Mail
2. Convert Message body to plain text
3. Re-direct Mail to cases@mail.com
I've written a script using applescript, the redirect is working so far but I'm not sure how I can implement the parsing of HTML to Plain text. I'm a total beginner with Applescript. Any help would be great. I'm open to other solutions or plugins that will help be convert a message to plain text. Thanks.
The code so far:
I get emails from work that send mail formatted as HTML, I want to Redirect that message to another inbox called "cases@mail.com"; the problem is, the case tool we use doesn't recognise HTML, so what I'm trying to do is re-direct plaintext messages instead. My logic is as follows:
1. Receive Mail
2. Convert Message body to plain text
3. Re-direct Mail to cases@mail.com
I've written a script using applescript, the redirect is working so far but I'm not sure how I can implement the parsing of HTML to Plain text. I'm a total beginner with Applescript. Any help would be great. I'm open to other solutions or plugins that will help be convert a message to plain text. Thanks.
The code so far:
Code:
tell application "Mail"
set AppleScript's text item delimiters to ""
set theRedirectRecipient to "cases@mail.com"
set theRedirectSender to "Case manager"
set theMessages to the selection
repeat with thisMessage in theMessages
tell application "Mail"
set theRedirectedEmail to redirect thisMessage
tell theRedirectedEmail
if subject of thisMessage is "" then
set subject of theRedirectedEmail to "Subject Was Empty"
end if
make new to recipient at beginning of to recipients with properties {address:theRedirectRecipient}
delete bcc recipients
delete cc recipients
end tell
set the sender of theRedirectedEmail to theRedirectSender
#delay 1
send theRedirectedEmail
end tell
end repeat
end tell