NAME
Test::Reporter::POEGateway::Mailer - Sends reports via a configured mailer
SYNOPSIS
#!/usr/bin/perl
use strict; use warnings;
use Test::Reporter::POEGateway::Mailer;
# A sample using SMTP+SSL with AUTH
Test::Reporter::POEGateway::Mailer->spawn(
'mailer' => 'SMTP',
'mailer_conf' => {
'smtp_host' => 'smtp.mydomain.com',
'smtp_opts' => {
'Port' => '465',
'Hello' => 'mydomain.com',
},
'ssl' => 1,
'auth_user' => 'myuser',
'auth_pass' => 'mypass',
},
);
# run the kernel!
POE::Kernel->run();
ABSTRACT
This module is the companion to Test::Reporter::POEGateway and handles the task of actually mailing out reports. Typically you just spawn the module, select a mailer and let it do it's work.
DESCRIPTION
Really, all you have to do is load the module and call it's spawn() method:
use Test::Reporter::POEGateway::Mailer;
Test::Reporter::POEGateway::Mailer->spawn( ... );
This method will return failure on errors or return success. Normally you would select the mailer and set various options.
This constructor accepts either a hashref or a hash, valid options are:
alias
This sets the alias of the session.
The default is: POEGateway-Mailer
poegateway
If this option is present in the arguments, this module will receive reports directly from the Test::Reporter::POEGateway session. You cannot enable this option and use the reports argument below at the same time. If you enable this, this component will not use POE::Component::DirWatch and ignores any options for it.
The default is: undef ( not used )
use Test::Reporter::POEGateway;
use Test::Reporter::POEGateway::Mailer;
Test::Reporter::POEGateway->spawn(
'mailer' => 'mymailer',
);
Test::Reporter::POEGateway::Mailer->spawn(
'alias' => 'mymailer',
'poegateway' => 1,
'mailer' => 'SMTP',
'mailer_conf' => { ... },
);
reports
This sets the path where it will read received report submissions. Should be the same path you set in Test::Reporter::POEGateway.
NOTE: If this module fails to send a report due to various reasons, it will move the file to '$reports/fail' to avoid re-sending it over and over.
The default is: $ENV{HOME}/cpan_reports
mailer
This sets the mailer subclass. The only one bundled with this distribution is Test::Reporter::POEGateway::Mailer::SMTP.
NOTE: This module automatically prepends "Test::Reporter::POEGateway::Mailer::" to the string.
The default is: SMTP
mailer_conf
This sets the configuration for the selected mailer. Please look at the POD for your selected mailer for what options is accepted.
NOTE: This needs to be a hashref!
The default is: {}
dirwatch_alias
This sets the alias of the POE::Component::DirWatch session. Normally you don't need to touch the DirWatch session, but it is useful in certain situations. For example, if you wanted to pause the watcher or re-configure - all you need to do is to send events to this alias.
The default is: POEGateway-Mailer-DirWatch
dirwatch_interval
This sets the interval passed to POE::Component::DirWatch, please see the pod for more detail.
The default is: 120
host_aliases
This is a value-added change from Test::Reporter::HTTPGateway. This sets up a hash of ip => description. When the mailer sends a report, it will munge the report by adding a "fake" environment variable: SMOKER_HOST and put the description there if the sender ip matches. This is extremely useful if you have multiple smokers running and want to keep track of which smoker sent which report.
Here's a sample alias list: host_aliases => { '192.168.0.2' => 'my laptop', '192.168.0.5' => 'my smoke box', '192.168.0.7' => 'gentoo VM on smoke box', },
The default is: {}
Commands
There is only one command you can use, as this is a very simple module.
shutdown
Tells this module to shut down the underlying httpd session and terminate itself.
$_[KERNEL]->post( 'POEGateway-Mailer', 'shutdown' );
More Ideas
Additional mailers ( sendmail ), that's for sure. However, Test::Reporter::POEGateway::Mailer::SMTP fits the bill for me; I'm lazy now :)
EXPORT
None.
SEE ALSO
Test::Reporter::POEGateway::Mailer::SMTP
AUTHOR
Apocalypse <apocal@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2009 by Apocalypse
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.