ex_postmark v1.3.0 ExPostmark.Adapters.Local.Storage
In-Storage storage driver used by the ExPostmark.Adapters.Local module. The emails in this mailbox are stored in Storage and won’t persist once your application is stopped.
Summary
Functions
List all the emails in the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.all()
[%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}]
Delete all the emails currently in the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.delete_all()
:ok
iex> Storage.list()
[]
Get a specific email from the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.get("A1B2C3")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
Pop the last email from the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.all() |> Enum.count()
1
iex> Storage.pop()
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.all() |> Enun.count()
0
Push a new email into the mailbox.
In order to make it easy to fetch a single email, a Message-ID
header is
added to the email before being stored.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
Starts the server
Stops the server
Functions
List all the emails in the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.all()
[%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}]
Delete all the emails currently in the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.delete_all()
:ok
iex> Storage.list()
[]
Get a specific email from the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.get("A1B2C3")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
Pop the last email from the mailbox.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.all() |> Enum.count()
1
iex> Storage.pop()
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}
iex> Storage.all() |> Enun.count()
0
Push a new email into the mailbox.
In order to make it easy to fetch a single email, a Message-ID
header is
added to the email before being stored.
Examples
iex> email = new |> from("tony.stark@example.com")
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, [...]}
iex> Storage.push(email)
%ExPostmark.Email{from: {"", "tony.stark@example.com"}, headers: %{"Message-ID": "a1b2c3"}, [...]}