NAME
XAS::System::Email - The Email module for the XAS environment
SYNOPSIS
Your program can use this module in the following fashion:
use XAS::System;
$email = XAS::System->module('email');
$email->send(
-from => "me\@localhost",
-to => "dba\@wsipc.org",
-subject => "Testing",
-message => "This is a test"
);
or ...
use XAS::System;
my $xas = XAS::System->module('environment');
my $email = XAS::System->module(
email => {
-mailer => 'smtp',
-server => 'relay.wsipc.org'
}
);
my $from = 'sysadm' . '@' . $xas->hostname . $xas->domain;
$email->send(
-from => $from,
-to => "dba\@wsipc.org",
-subject => "Testing",
-message => "This is a test"
);
DESCRIPTION
This is the the module for sending email within the XAS environment.
METHODS
new
This method initializes the module. It is automatically called when invoked by XAS::System->module(). It takes the following parameters:
- -server
-
The default is mail.example.com. This default can changed with the environment variable MXSERVER. It can also be changed with the named parameter -server upon load or the server() method after loading.
- -port
-
The default is 25. This default can be changed with the environment variable MXPORT. It can also be changed with the named parameter -port upon load or the port() method after loading.
- -mailer
-
This defines how the email is sent. There are two ways to send email they are a direct connection using smtp or queue the mail for transmittial using sendmail. The default is "smtp". This can be changed to "sendmail" with the named parameter -mailer upon load or the mailer() method after loading.
- -timeout
-
This sets the timeout used for sending email. The default is 60 seconds. This can be changed with the named parameter -timeout upon load or the timeout() method after loading.
send
This method will send an email. It takes the following named parameters:
- -to
-
The SMTP address of the receipent.
- -from
-
The SMTP adderss of the sender.
- -subject
-
A subject line for the message.
- -message
-
The text of the message.
- -attachment
-
A filename to append to the message.
MUTATORS
mailer
This method will set/return the current mailer.
Example
$mailer = $email->mailer;
$email->mailer('sendmail');
timeout
This method will set/return the current timeout value for mail processing.
Example
$timeout = $email->timeout;
$email->timeout('60');
server
This method will set/return the current mxserver value for mail processing.
Example
$server = $email->server;
$email->server('relay.wsipc.org');
port
This method will set/return the current mxport value for mail processing.
Example
$port = $email->port;
$email->port('25');
SEE ALSO
XAS::Base
XAS::Class
XAS::Constants
XAS::Exception
XAS::System
XAS::Utils
XAS::Apps::Base::Alerts
XAS::Apps::Base::Collector
XAS::Apps::Base::ExtractData
XAS::Apps::Base::ExtractGlobals
XAS::Apps::Base::RemoveData
XAS::Apps::Database::Schema
XAS::Apps::Templates::Daemon
XAS::Apps::Templates::Generic
XAS::Apps::Test::Echo::Client
XAS::Apps::Test::Echo::Server
XAS::Apps::Test::RPC::Client
XAS::Apps::Test::RPC::Methods
XAS::Apps::Test::RPC::Server
XAS::Collector::Alert
XAS::Collector::Base
XAS::Collector::Connector
XAS::Collector::Factory
XAS::Lib::App
XAS::Lib::App::Daemon
XAS::Lib::App::Daemon::POE
XAS::Lib::Connector
XAS::Lib::Counter
XAS::Lib::Daemon::Logger
XAS::Lib::Daemon::Logging
XAS::Lib::Gearman::Admin
XAS::Lib::Gearman::Admin::Status
XAS::Lib::Gearman::Admin::Worker
XAS::Lib::Gearman::Client
XAS::Lib::Gearman::Client::Status
XAS::Lib::Gearman::Worker
XAS::Lib::Net::Client
XAS::LIb::Net::Server
XAS::Lib::RPC::JSON::Client
XAS::Lib::RPC::JSON::Server
XAS::Lib::Session
XAS::Lib::Spool
XAS::Model::Database
XAS::Model::Database::Alert
XAS::Model::Database::Counter
XAS::Model::DBM
XAS::Monitor::Base
XAS::Monitor::Database
XAS::Monitor::Database::Alert
XAS::Scheduler::Base
XAS::System::Alert
XAS::System::Email
XAS::System::Environment
XAS::System::Logger
AUTHOR
Kevin L. Esteb, <kevin@kesteb.us>
COPYRIGHT AND LICENSE
Copyright (C) 2012 by Kevin L. Esteb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.