It doesn't bypass the rule
I need the code to work together with the rule. Isn't there any possibility to obtain such a thing? The rule moves the messages from INBOX to a local folder, after it forwards them, and leaves them unread. Can something be done with the code so that it will ignore unread messages? That will probably be sufficient for the code to work with the rule.