NAME

Email::Store::Mail - An email in the database

SYNOPSIS

Email::Store::Mail->store($message)

my $mail = Email::Store::Mail->retrieve($msgid);

my $simple = $mail->simple;
print $mail->message;

# Plus many additional accessors added by plugins

DESCRIPTION

While a fundamental concept in Email::Store, a mail is by itself reasonably simple. It only has two properties, a message_id and a message. A utility method simple will produce a (cached) Email::Simple object representing the mail.

Indexing

When a mail is indexed with store, all the plugins are called. Plugins register a method called on_store to get their chance to play with an incoming mail, and on_store_order to determine where in the process they wish to be called in relation to other modules.

The on_store method gets passed the mail object and can examine and modify it while also doing what it needs to populate its own table(s).

Indexing Duplicates

When a message is stored but already exists in the database, on_seen_duplicate is called in the plugins rather than on_store. This allows, for instance, the List plugin to detect passage through addiional lists.