0
votes

I am trying to extract HTML from emails using AppleScript. I came across this StackExchange post -- Mac Automator/Applescript(?) to extract URL's from Mail messages -- which tries to extract URLs from email content. The extraction code is:

on run {input, parameters}
    set mailContentList to {}
    tell application "Mail"
        repeat with selectedMail in input
            set end of mailContentList to content of selectedMail
        end repeat
    end tell
    return mailContentList
end run

This only extracts the visible content, not the entire HTML content. I tried adding with properties {visible:false} after content and then after input with no luck from either.

1

1 Answers

1
votes

You get the raw source with the source property

set end of mailContentList to source of selectedMail

but you have to extract the HTML portion "manually".