【发布时间】:2015-12-21 04:28:02
【问题描述】:
我已经编写了 - 当然是在各种来源的帮助下 - 这个脚本批量重定向邮件:它重定向邮件应用程序中选择的所有邮件。好像没什么特别的。
tell application "Mail"
set AppleScript's text item delimiters to ""
set theRedirectRecipient to "redirectmail@mail.mail"
set theRedirectSender to "Sender"
set theMessages to the selection
repeat with thisMessage in theMessages
tell application "Mail"
set theRedirectedEmail to redirect thisMessage with opening window
tell theRedirectedEmail
if subject of thisMessage is "" then
set subject of theRedirectedEmail to "Mails zonder subject"
end if
make new to recipient at beginning of to recipients with properties {address:theRedirectRecipient}
#delete bcc recipients
#delete cc recipients
end tell
#delay 2
#send theRedirectedEmail
end tell
end repeat
end tell
如上所述,脚本运行良好:它创建重定向邮件,如果我按下发送按钮,它会像我需要的那样工作。
但是有 3 行注释掉了,不起作用。删除行和发送行。我不确定我是否关心删除的那些,但我已经将它们包括在内,以防有人能看到模式。
取消注释其中一行会给我这个错误:
error "邮件出错:无法获取外发的每个抄送收件人 消息 id 18." 来自每个 cc 传出收件人的号码 -1728 消息 ID 18
同样,这确实会创建一个消息窗口,如果手动完成,我可以成功发送。
取消注释“发送”行会引入以下错误:
error "邮件出错:传出邮件 id 19 不理解 “发送”消息。”来自传出消息 id 19 的编号 -1708
所以我得出的结论是,创建的消息不表现为消息“应该”。我已经看到 this thread 的“传出消息”似乎显示了这种行为。
这条名为theRedirectEmail 的消息是怎么回事?如何向该对象发送消息,例如 delete 和 send?
【问题讨论】:
标签: redirect applescript