POP3 client library for Lua
Lua
Switch branches/tags
Pull request Compare This branch is 2 commits ahead, 21 commits behind moteus:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmake
examples
lua
rockspecs
test
.travis.yml
CMakeLists.txt
LICENCE.txt
README.md
dist.info
lakefile

README.md

lua-pop3

##Build status## Build Status Coverage Status

POP3 client library for Lua 5.1 / 5.2

##Dependences##

###Decode text headers/content###

###Parse from/to/reply headers###

###MD5 modules###

###APOP auth###

###CRAM MD5 auth###

  • lua-crypto
  • or one of MD5 modules and bit library.

###Detect current codepage on Windows###

Usage

local pop3 = require "pop3"

local some_mail = {
  host     = os.getenv("LUA_MAIL_HOST") or '127.0.0.1';
  username = os.getenv("LUA_MAIL_USER") or 'me@host.local';
  password = os.getenv("LUA_MAIL_PASS") or 'mypassword';
}

local mbox = pop3.new()

mbox:open(some_mail.host, some_mail.port or '110')
print('open   :', mbox:is_open())

mbox:auth(some_mail.username, some_mail.password)
print('auth   :', mbox:is_auth())

for k, msg in mbox:messages() do
  print"----------------------------------------------"
  print("NO:         ", k)
  print("ID:         ", msg:id())
  print("subject:    ", msg:subject())
  print("to:         ", msg:to())
  print("from:       ", msg:from())
  print("from addr:  ", msg:from_address())
  print("reply:      ", msg:reply_to())
  print("reply addr: ", msg:reply_address())
  print("trunc:      ", msg:is_truncated())
  for i,v in ipairs(msg:full_content()) do
    if v.text then  print("  ", i , "TEXT: ", v.type, #v.text)
    else print("  ", i , "FILE: ", v.type, v.file_name or v.name, #v.data) end
  end
end

Bitdeli Badge