XAS::System::Email - The Email module for the XAS environment
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" );
This is the the module for sending email within the XAS environment.
This method initializes the module. It is automatically called when invoked by XAS::System->module(). It takes the following parameters:
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.
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.
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.
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.
This method will send an email. It takes the following named parameters:
The SMTP address of the receipent.
The SMTP adderss of the sender.
A subject line for the message.
The text of the message.
A filename to append to the message.
This method will set/return the current mailer.
Example
$mailer = $email->mailer; $email->mailer('sendmail');
This method will set/return the current timeout value for mail processing.
$timeout = $email->timeout; $email->timeout('60');
This method will set/return the current mxserver value for mail processing.
$server = $email->server; $email->server('relay.wsipc.org');
This method will set/return the current mxport value for mail processing.
$port = $email->port; $email->port('25');
Kevin L. Esteb, <kevin@kesteb.us>
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.
To install XAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS
CPAN shell
perl -MCPAN -e shell install XAS
For more information on module installation, please visit the detailed CPAN module installation guide.