пытается переместить электронные письма, не адресованные мне, в подпапку с помощью AppleScript в Outlook - PullRequest
0 голосов
/ 18 апреля 2020

У меня есть все эти электронные письма, которые адресованы не мне, а группам, частью которых я являюсь. Они раздражают и означают, что мне трудно заметить электронные письма, адресованные мне. Я пробовал следующий код в AppleScript:

tell application "Microsoft Outlook"
    set myInbox to folder "Inbox" of default account
    set archive to folder "Archive" of default account

    set theMessages to messages of inbox

    set countMoved to 0

    repeat with theMessage in theMessages
        try
            set theSender to sender of theMessage
            set fromAddress to address of theSender
            set theRecipient to to recipient of theMessage
            set toAddress to address of theRecipient
            set ccRecipient to cc recipient of theMessage
            set ccAddress to address of ccRecipient

            # Start of mail specific rules

            if fromAddress is not ("email1@example.com" or fromAddress is not "email2@example.com") then
                if toAddress is not ("myemail@example.com" or ccAddress is not "myemail@example.com") then
                    move theMessage to folder "Not to me" of archive
                    set countMoved to countMoved + 1
                end if

            end if

        end try
    end repeat


    log "Outlook cleanup ran " & " - " & countMoved & " moved."

end tell

Когда я запускаю это, я получаю ( Выполнена очистка Outlook - 0 перемещено. ) в качестве вывода. Должно быть что-то с тем, как я использую «для получателя» и «cc получатель», как это хорошо, когда на других скриптах, которые я создал, когда я использовал «для отправки».

Заранее спасибо .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...