NAME

TipJar::MTA::queue - send e-mail via TipJar::MTA

SYNOPSIS

use TipJar::MTA::queue '/var/MTAspool'; # sets $TipJar::MTA::queue::basedir 
my $m = new TipJar::MTA::queue;
$m->return_address('me@mydomain.tld');
$m->recipient('you@yourdomain.tld'); # must pass sanity check
$m->data(<<EOF);	# include all headers
From: my name <iamthesender\@mydomain.tld>
To: your name <you@yourdomain.tld>
Subject: this is a test from me to you

This was sent out via the TipJar::MTA outbound SMTP system! EOF $m->enqueue(); # a TipJar::MTA daemon on /var/MTAspool # will attempt delivery presently. $m # is cleared for reuse. $m->return_address('list-bounces@mydomain.tld'); $m->recipient(@list_members); # will expand array refs ...

DESCRIPTION

TipJar::MTA::queue creates messages in the outgoing queue of a TipJar::MTA daemon. It is provided for use within other software that composes the mails. It does not provide any header lines or MIME formatting etc. -- you have to get that elsewhere and use the provided interface to add the data to the object.

GLOBALS

$TipJar::MTA::queue::basedir

this package variable holds the base directory of the TipJar::MTA queue; (see)

METHODS

new

returns a blessed object reference. Many of these can coexist without interfering with each other.

return_address

takes a scalar which must pass a sanity test which is probably not loose enough, will croak when the return_address is not sane

recipient

takes one or more addresses or array references. Trusts that the addresses it is given are valid. Invalid addresses will stop processing and get included as weird header lines. Array references are not expanded until enqueue() time.

data

Appends its argument(s) to the message data block.

enqueue

Constructs a new message file according to the TipJar::MTA new message format, and clears the object for reuse.

EXPORT

None.

to-not-do list

header generation and checking; other bells and whistles

it would be nice to insert more headers into the message. mail::Sendmail looks like the place to from which to lift features. OTOH, the clarity of only allowing return address, recipient list, and data is good; perhaps using another module to compose header lines and building the data block before passing it to $m->data() is the way to go. So I might create and publish a TipJar::MTA::compose module which will rely on the TipJar::MTA::queue interface to post its composed messages.

INTERNALS

The object is at this time an array-based object originally facilitated using TipJar::fields, but now it just has the field names written into it as constant functions.

CAVEATS

This module (and the TipJar::MTA daemon) rely on flock locking for data corruption control, so it is not reccommended for use on a shared volume (such as NFS) unless your locking daemons are cooperative and robust.

HISTORY

0.01

Original version, April 2003

0.02

test script now sends the author two e-mails, in concert with the test script of the TipJar::MTA module. See the test script for example of a date header generator.

AUTHOR

david nicol <davidnico@cpan.org>

LICENSE

GPL/AL, enjoy.

SEE ALSO

CPAN has myriad modules to help with composing and sending e-mail.

None of them have the same interface.