An open API service indexing awesome lists of open source software.

https://github.com/konimarti/elixir-mbox

Read and write MBOX files in Elixir
https://github.com/konimarti/elixir-mbox

mail mbox parser reader writer

Last synced: 4 months ago
JSON representation

Read and write MBOX files in Elixir

Awesome Lists containing this project

README

          

# Mbox

Read and write mbox files. Works well in combination with
[elixir-mail](http://github.com/DockYard/elixir-mail).

Elixir fork of [go-mbox](http://www.github.com/emersion/go-mbox).

## Installation

```elixir
def deps do
[
# Get from hex
{:mbox, "~> 0.1.0"}

# Or from github
{:mbox, github: "konimarti/elixir-mbox"}
]
end
```

## Usage

#### Parse mbox files

```elixir
{:ok, body} = File.read("path/to/mboxfile")
messages = Mbox.Parser.parse(body)
```

#### Render mbox files

```elixir
output = Mbox.Renderer.render(messages)
```

#### In combination with elixir-mail

```elixir

{:ok, body} = File.read("path/to/mboxfile")

mails =
body
|> Mbox.Parser.parse
|> Enum.map(&Mail.Parsers.RFC2822.parse/1)
```