我要做的是设置Mail.app规则,将所有iTunes收据电子邮件重定向到Evernote中的特定笔记本。以下AppleScript添加了正确的收件人并修改了主题行,因此我可以包含指向正确的Evernote笔记本的指针。问题是我无法弄清楚为什么电子邮件的内容会被复制两次。任何帮助表示赞赏。
更新:为了澄清,此脚本作为Mail.app规则的一部分运行。当电子邮件符合规则时,将运行以下AppleScript。如果您不熟悉Evernote通过电子邮件添加项目的能力,它的工作方式如下:每个Evernote用户都会收到一个唯一的电子邮件地址,允许将项目直接添加到他们的Evernote帐户。在主题行中,可以添加某些关键字以将文档定向到特定文件夹(@Receipts)或添加特定标签(#cool)。
using terms from application "Mail"
on perform mail action with messages theMessages
repeat with thisMessage in theMessages
tell application "Mail"
set newMessage to redirect thisMessage with opening window
tell newMessage
set subject of newMessage to "hello"
make new to recipient at beginning of to recipients with properties {address:"mine@email.com"}
delete bcc recipients
delete cc recipients
end tell
set the sender of newMessage to "me@me.com"
delay 1
-- send newMessage
end tell
end repeat
end perform mail action with messages
end using terms from
答案 0 :(得分:0)
我已尝试使用Mac OS X 10.6.8和Mail 4.6.1085以及纯文本电子邮件。电子邮件的正文文本一开始并没有在这个设置中重复,但后来我注意到它确实在我的另一个自动回复功能中重复了。这就是发生的事情:
我认为你可以通过存储原始文本并在发送消息之前再次设置它来解决这个问题。以下似乎不会发送带有重复文本的消息:
using terms from application "Mail"
on perform mail action with messages theMessages
repeat with thisMessage in theMessages
tell application "Mail"
set theText to content of thisMessage
set newMessage to redirect thisMessage with opening window
tell newMessage
set subject of newMessage to "hello"
make new to recipient at beginning of to recipients with properties {address:"mine@email.com"}
delete bcc recipients
delete cc recipients
end tell
set the sender of newMessage to "me@me.com"
set content of newMessage to thisText
delay 1
-- send newMessage
end tell
end repeat
end perform mail action with messages
end using terms from
答案 1 :(得分:0)
当我尝试转发消息时,我遇到了同样的问题(运行10.6到10.9) 我通过在添加另一个主题之前存储新消息的内容来修复它......
set themessage to forward eachMail with opening window
set a to content of themessage
set thesubject to (subject of eachMail) as rich text
tell themessage
set subject to thesubject
repeat with m in mailtos
make new to recipient at end of to recipients with properties {address:m}
end repeat
set content to a
end tell