Mail::Queue::DB - store outgoing email locally in a Berkely DB
use Mail::Queue::DB; my $d = new Mail::Queue:DB( db_file => '.database'); print $d->count_queue() . " messages in the queue.\n"; my $msg_id = $d->queue_mail($args, $msg); $z->dequeue_mail($msg_id); print $d->count_queue() . " messages in the queue.\n";
Mail::Queue::DB allows one to create a local outgoing email store in Berkely DB format. This mail can then be flushed over SSH or some other connection to an appropriate mailhost. This module and the associated tools work well on systems like laptops that need to be able to send mail while offline. It was designed to be complementary to OfflineIMAP.
Creates a new Mail::Queue::DB object. The argument db_file must be defined.
Adds a new message to the queue. Args must contain the arguments required to pass to sendmail to actually send the email. Typically, these arguments will be something like: -oem -oi -- email@example.com
Msg contains the actual email message to be transmitted.
On success, the message id of the newly queued email will be returned. On failure, queue_mail() returns undef
Deletes a message from the queue. Id must contain a valid message id. dequeue_mail() will attempt to attain a write lock on the database unless the boolean value have_lock is set.
On success, queue_mail() returns 0. On failure, it returns a negative value.
Fetches the message identified by Id from the queue. On success, it returns an array of Args, Msg. On failure it returns undef.
For each message in the queue, run the passed callback function. Lock state specifies the lock to hold for the entire iteration run. It can be one of either read or write. If not specified, a read lock is assumed.
The passed in callback will receive arguments in the form callback( $id, $args, $msg )
Returns an integer representing the number of emails currently in the queue.
S. Zachariah Sprackett <firstname.lastname@example.org>
(C) Copyright 2004, S. Zachariah Sprackett <email@example.com>
Distributed under the terms of the GPL version 2 or later.