邮件规则的Applescript

时间:2016-06-19 07:22:30

标签: applescript

我已经创建了一条规则,即消息根据特定条件移动到子文件夹中。 此外,我已在此规则中保存了AppleScript,此邮件随后会复制到DMS中。 它正在发挥作用。

我的问题是,子文件夹的名称(暂时)没有传递给脚本。它只包含“INBOX”:

using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
        tell application "Mail"
            repeat with theMessage in theMessages
                set nameAccount to name of mailbox of theMessage  # here is the problem !
                try
                    tell theMessage
                        — at this point get the data out of the mail
                    end tell
                    tell application id „DMS“
                        — here the  data will save to the dms
                    end tell
                end try
            end repeat
        end tell
        #            end try
        #        end tell
    end perform mail action with messages
end using terms from

如何从活动邮件规则中获取目标文件夹的名称?

1 个答案:

答案 0 :(得分:1)

而不是name获取整个mailbox对象,它包含文件夹层次结构中的实际引用,以创建您需要引用的子文件夹。

set theMailbox to mailbox of theMessage

PS:不需要tell application "Mail"块,using terms块足以评估术语。