[imapfilter-devel] Adding a header flag all messages

Steve Traylen steve.traylen at cern.ch
Tue Nov 22 18:36:03 EET 2011


Hi,

This is my really my first go with imapfilter. I took the example
from man page and sample files and modified a little.

The plan - Take mail from INBOX and write to Mutt having added
an X-Label.

CERN.Mutt:check_status()
CERN.INBOX:check_status()
results = CERN.INBOX:select_all()

for _, mesg in ipairs(results) do
    mbox, uid = unpack(results)
    header    = mbox[uid]:fetch_header()
    body      = mbox[uid]:fetch_body()
    message   = header:gsub('[\r\n]+$', '\r\n') ..
              'X-Label: C\r\n' .. '\r\n' .. body
    CERN.Mutt:append_message(message)
end

result.

Subscribed mailbox straylen at imap.cern.ch/INBOX.
268 messages, 0 recent, 268 unseen, in straylen at imap.cern.ch/INBOX.
Subscribed mailbox straylen at imap.cern.ch/Mutt.
6270 messages, 0 recent, 6266 unseen, in straylen at imap.cern.ch/Mutt.
268 messages, 0 recent, 268 unseen, in straylen at imap.cern.ch/INBOX.
imapfilter: /afs/cern.ch/user/s/straylen/.imapfilter/config.lua:29:
attempt to index field '?' (a nil value)

Which is the

    header    = mbox[uid]:fetch_header()

line.

Lua 5.1.4
IMAPFilter 2.2.2
And against exchange :-(

Many thanks for getting me going on this, ... looks very good.

Steve.





-- 
Steve Traylen


More information about the Imapfilter-devel mailing list