lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I want to write a script to log into my gmail account via imap, search for a specific message (based on the subject and date) and download and untar the attachment from that message (there will only be one for each day). Can this be easily done in lua? Can someone point me to an example?

Recently i play with imap4.lua[1] and my pop3.message[2] library.
You can retrieve rfc822 message using IMAP fetch command and then parse message.
I never use imap4.lua in real work so may be there has better library. 

  for _,v in pairs(connection:fetch("(RFC822)") do
    local msg = assert(pop3.message(v.RFC822))
    -- msg:subject()
    for i,body in ipairs(msg:attachments()) do
      -- body.file_name