使用AppleScript将邮件设置为纯文本 [英] Using AppleScript to set a mail message to Plain Text

查看:110
本文介绍了使用AppleScript将邮件设置为纯文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an AppleScript that nicely collates information and creates an email message with attachments.

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

I cannot find a way for the script to set the message format to "Plain Text" which is required by the receiving inbox (rather than the default "Rich Text").

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

Is there an AppleScript way (or trick) to setting the message format to "Plain Text"?

推荐答案

我在尝试解决此问题时发现了这个问题.最终,我提出了以下解决方案:

I found this question while trying to solve exactly this problem. Eventually I came up with the following solution:

tell application "Mail"
    set newMessage to make new outgoing message 
        with properties {visible:true,
                         subject:"message title",
                         sender:"sender@from.address",
                         content:mailBody}
    tell newMessage
        make new to recipient with properties {address:"mail@recipient.com"}
    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

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

Hopefully someone will find this useful, I know I would have several hours ago!

这已在邮件版本7.3和12.4上进行了测试.较新或较旧的版本可能需要不同的菜单标题.

This is tested on Mail versions 7.3 and 12.4. Newer, or older, versions might need different menu titles.

这篇关于使用AppleScript将邮件设置为纯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆