Lua Maildir Library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Markus Bergholz 9829e16031 oh shit, always write to folder '/new' 3 years ago
LICENSE Initial commit 3 years ago
Maildir.lua oh shit, always write to folder '/new' 3 years ago
README.md add 2nd methode to change the Maildir folder. version 0.2 3 years ago

README.md

Lua Maildir

Library to manipulate Maildir format.

Status

Version 0.2

  • support switching folder now

Version 0.1

  • only add new messages is supported

usage

Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> md = require "Maildir"
> maildir = md.new ("users/markus")
> maildir:add ("new message by lua_maildir at 21:13\nhelo friend\n.\n")
true
> maildir = maildir:get_folder ("spam")
> maildir:add ("spam spam spam\n")
true

$ cat users/markus/new/1479932016.NI2KQA5K9YKV.lua_maildir 
new message by lua_maildir at 21:13
helo friend
.
$ cat users/markus/spam/1480160192.L0KJ435IXO6B.UNKOWN 
spam spam spam

maildir:add (msg) will place the E-Mail (type(msg) == "string") in the new folder of Maildir. When the Maildir folder does not exists, it will create {tmp, cur, new} folder of the Maildir structure. When adding the msg was successfull, the return value is true, otherwise it’s false.

In general, the msg should follow the rfc2822 (lua-maildir won’t verify it!). Otherwise your Mail-Clients, you or both will get in trouble.