要将发送的消息转换为纯文本,可以使用以下AppleScript代码示例:
tell application "Mail"
set selectedMessages to selection
repeat with theMessage in selectedMessages
set theContent to content of theMessage as rich text
set plainTextContent to (do shell script "echo " & quoted form of theContent & " | textutil -convert txt -stdin -stdout")
set content of theMessage to plainTextContent
end repeat
end tell
这段代码将从Mac上的Mail.app应用程序中选中的消息转换为纯文本。它使用了do shell script
命令来调用textutil
命令行工具将富文本内容转换为纯文本。然后,将转换后的纯文本设置为消息的新内容。
要使用这段代码,可以将其复制并粘贴到AppleScript编辑器中,然后保存为脚本文件。然后,您可以在需要的时候运行该脚本文件来转换选中的邮件消息为纯文本。