Mac 从邮​​件消息中提取 HTML

Mac to extract HTML from Mail messages

我正在尝试使用 AppleScript 从电子邮件中提取 HTML。我遇到了这个 StackExchange post -- -- 它试图从电子邮件内容中提取 URL。提取码为:

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

这只会提取 visible 内容,而不是整个 HTML 内容。我尝试在 content 之后添加 with properties {visible:false},然后在 input 之后添加,但都没有成功。

您通过 source 属性

获取原始源
set end of mailContentList to source of selectedMail

但您必须提取 HTML 部分 "manually"。