[英]Can I set the encoding of an e-mail message created by AppleScript?
我必须发送邮件列表,并想为此使用Apple Mail。 我创建了一个脚本,该脚本读取UTF8编码的文本文件,并使用该文本设置电子邮件的内容。 该文本在变量thisText中。 导入文本的代码类似于
set fileHandle to open for access theFile
set mailText to (read fileHandle) as «class utf8»
close access fileHandle
在此之后,我对每个收件人的文本进行一些小的调整,并使用以下代码准备电子邮件:
using terms from application "Mail"
tell application "Mail"
set theAccount to "Economy-x-Talk Support"
set theNewMessage to make new outgoing message with properties ¬
{account:theAccount, subject:thisSubject, content:thisText, visible:false}
tell theNewMessage
make new to recipient at end with properties {address:thisEmail}
set sender to "Economy-x-Talk Support <xxx@xxxxxxxx.com>"
end tell
end tell
end using terms from
问题是,如果文本包含特殊字符,则Mail会错误地显示它们。 我相信Mail无法理解邮件的编码是UTF8。 创建消息时,是否可以定义消息的编码? 就像是:
properties {encoding:utf8}
也许? 我试过了,但是没有用。 我在其他地方找不到答案。
我发现有关此功能是否有效的冲突信息,但是尝试使用以下终端命令更改默认邮件编码:
defaults write com.apple.mail NSPreferredMailCharset "UTF-8"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.