[imapfilter-devel] Conditional Actions in config.lua
Paul
imapfilter at airbred.com
Fri Apr 16 02:32:44 EEST 2010
Hello,
I have just started exploring imapfilter and it looks excellent.
One thing I am trying to do however is do conditional actions depending on
some previous action succeeding or not. For example, I want to copy some
messages from one account to another and if this succeeds, to archive the
originals.
Something like this:
-- accounts
account1 = IMAP { xxx }
account2 = IMAP { yyy }
results = account1.INBOX:select_all()
if results:copy_messages(account2.incoming)
results:move_messages(archive)
end
-------------------
So that if for any reason, the account2 imap server isn't available or the
folder cannot be written to or whatever the error may be, the email
messages are left where they are, and can be processed in the next run.
However, it doesn't look like copy_messages has a return code, so I can't
wrap an if around it. I tried stopping the account2 imap server and while
the copy_messages excepts, the move_messages still seems to action.
Has anyone done something similar?
More information about the Imapfilter-devel
mailing list