NAME
Email::Sender::Server::Client - Email Delivery Agent
VERSION
version 0.19
SYNOPSIS
# sending email is simple
use Email::Sender::Server::Client 'mail';
my @message = (
to => '...',
subject => '...',
body => '...',
);
my ($client) = mail @message;
if ($client->error_count) {
die $client->errors_to_string;
}
my ($mailer, $msg_id) = mail @message;
unless ($msg_id) {
die $mailer->errors_to_string;
}
or using an object-oriented approach ....
use Email::Sender::Server::Client;
my $client = Email::Sender::Server::Client->new;
my @message = (to => '...', subject => '...', body => '...');
my $msg_id = $client->send(@message);
if ($client->error_count) {
print $client->errors_to_string;
}
altering or using a non-sendmail transport ...
use Email::Sender::Server::Client;
my $client = Email::Sender::Server::Client->new;
my @message = (to => '...', subject => '...', body => '...');
push @message, 'transport' => {
# key is the Email::Sender transport driver,
# value is the transport driver's arguments
STMP => {
host => '...',
port => '...',
}
};
my ($msg_id) = $client->send(@message);
unless ($msg_id) {
print $client->errors_to_string;
}
Please see the Email::Sender::Server::Message class for attributes that can be used as arguments to the mail() and send() methods.
Currently all ESS classes operate out of the current-working-directory which can be sub-optimal, especially when used in other classes that can be utilized by various different scripts.
The ESS_DATA environment variable can be set to change the path of the .ess directory utilized by the current program, otherwise you may use the path parameter. When changing the path to the .ess directory, please specify a path to the parent directory and not the .ess directory itself.
use Email::Sender::Server::Client 'mail';
# if you need to change the ess data directory
push @message, path => '/path/to/ess/parent/folder' ;
my ($client) = mail @message;
DESCRIPTION
Email::Sender::Server::Client provides an interface to the ESS non-blocking email delivery system which queues emails for later delivery. This class is a simple wrapper around the Email::Sender::Server::Manager class, the manager is responsible for queuing email messages and delegating tasks to the worker processes. Note, All messages are validated by Email::Sender::Server::Message.
EXPORTS
The mail method is designed to provide a simple single method for sending emails to the server. It accepts valid attributes accepted by Email::Sender::Server::Message. It returns a list of two elements, a client object and the filepath of the queued message if the operation was successful.
METHODS
send
The send method is designed to provide an object-oriented approach for sending emails to the server. It accepts all valid attributes accepted by Email::Sender::Server::Message. It returns a the filepath of the queued message if the operation was successful.
AUTHOR
Al Newkirk <awncorp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by awncorp.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.