使用 AppleScript 将邮件消息设置为纯文本

2023-12-14

我有一个 AppleScript,可以很好地整理信息并创建带有附件的电子邮件。

我找不到脚本将消息格式设置为接收收件箱所需的“纯文本”(而不是默认的“富文本”)的方法。

是否有 AppleScript 方法(或技巧)将消息格式设置为“纯文本”?


我在尝试解决这个问题时发现了这个问题。最终我想出了以下解决方案:

tell application "Mail"
    set newMessage to make new outgoing message 
        with properties {visible:true,
                         subject:"message title",
                         sender:"[email protected]",
                         content:mailBody}
    tell newMessage
        make new to recipient with properties {address:"[email protected]"}
    end tell
    activate
end tell

tell application "System Events"
    click menu item "Make Plain Text" of ((process "Mail")'s (menu bar 1)'s (menu bar item "Format")'s (menu 1))
end tell

希望有人会发现这很有用,我知道我几个小时前就会发现!

这是在 Mail 版本 7.3 和 12.4 上进行测试的。较新或较旧的版本可能需要不同的菜单标题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 AppleScript 将邮件消息设置为纯文本 的相关文章

随机推荐