bamboo v0.6.0 Bamboo.SentEmail

Used for storing and retrieving sent emails when used with Bamboo.LocalAdapter

When emails are sent with the Bamboo.LocalAdapter, they are stored in Bamboo.SentEmail. Use the functions in this module to store and retrieve the emails.

Remember to start the Bamboo app by adding it to the app list in mix.exs or starting it with Application.ensure_all_started(:bamboo)

Summary

Functions

Returns a list of all sent emails

Gets an email by id. Returns nil if it can’t find a matching email

Gets an email by id. Raises if it can’t find one

Gets the email’s id

Returns exactly one sent email. Raises if none, or more than one are found

Adds an email to the list of sent emails

Clears all sent emails

Starts the SentEmail Agent

Functions

all()

Returns a list of all sent emails

get(id)

Gets an email by id. Returns nil if it can’t find a matching email.

get!(id)

Gets an email by id. Raises if it can’t find one.

get_id(email)

Gets the email’s id.

The email must be an email that was sent with Bamboo.LocalAdapter or added via SentEmail.push/1, otherwise the id will not have been set.

one()

Returns exactly one sent email. Raises if none, or more than one are found

Raises NoDeliveriesError if there are no emails. Raises DeliveriesError if there are 2 or more emails.

push(email)

Adds an email to the list of sent emails

Adds an email to the beginning of the sent emails list. Also gives the email an id that can be fetched with SentEmail.get_id/1.

reset()

Clears all sent emails

start_link()

Starts the SentEmail Agent