[imapfilter-devel] Error: attempt to index field 'INBOX'
Lefteris Chatzimparmpas
lefcha at hellug.gr
Fri Oct 19 21:45:48 EEST 2007
On Fri, Oct 19, 2007 at 02:15:01PM -0300, Alejandro Jakubi wrote:
> Hi,
>
> I have setup a filter function in config.lua (see below the relevant lines).
> The intention is that messages with [SPAM] in the subject are moved to the
> folder SPAM and become marked as deleted. There is no problem with the moving
> part, but adding the third line below (for marking as deleted) generates this
> output:
>
> imapfilter: xxxx/.imapfilter/config.lua:3: attempt to index field
> 'INBOX' (a nil value)
>
> Version of imapfilter is 1.3.
Hello
If you are using imapfilter 1.3 then you should read the documentation
that comes with that version. I'll explain to you what I mean...
> [...]
>
> ====
> function filtrar()
> r_spam = match(account1, 'INBOX', spam)
> account1.INBOX:mark_deleted(r_spam)
> move(account1, 'INBOX', account1, 'mail/SPAM', r_spam)
> ...
> end
>
> [...]
You are mixing configuration of 1.x versions with the newer 2.x.
Version 2.x can understand old 1.x config files but not the other way
around. Also, you can't mix the two.
The second line inside the function filtrar() should be:
flag(account1, 'INBOX', 'add', { 'deleted' }, r_spam)
This is the correct format for 1.x, instead of the mark_deleted() you
use, that is part of the new syntax for 2.x.
But keep in mind, that when you move() messages to another mailbox, they
are by default marked deleted in the source mailbox, and thus, you don't
really need to flag() them.
More information about the Imapfilter-devel
mailing list