我想要做的是設置一個Mail.app規則,將所有iTunes收據電子郵件重定向到Evernote中的特定筆記本。以下AppleScript添加正確的收件人並修改主題行,以便可以將指針包含到正確的Evernote筆記本中。問題是我無法弄清楚爲什麼電子郵件的內容被複制兩次。任何幫助表示讚賞。使用AppleScript重定向電子郵件時,電子郵件的內容是重複的。爲什麼?
更新:爲了說明起見,此腳本作爲Mail.app規則的一部分運行。當一封電子郵件與規則匹配時,下面的AppleScript將運行。如果您不熟悉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:"[email protected]"}
delete bcc recipients
delete cc recipients
end tell
set the sender of newMessage to "[email protected]"
delay 1
-- send newMessage
end tell
end repeat
end perform mail action with messages
end using terms from
這可能有助於診斷:它發生在'重新創建收件人...'之後。 – 2013-04-11 03:05:27
是的,我也注意到了,但我無法弄清楚爲什麼會發生這種情況,或者我的替代方案是爲了實現相同的目標。 – 2013-04-11 03:54:37