Last change
on this file since 2214 was
1011,
checked in by nanardon, 12 years ago
|
- Add documentation to LATMOS::Accounts::Mail
|
-
Property svn:executable set to
*
|
File size:
1.0 KB
|
Rev | Line | |
---|
[990] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use LATMOS::Accounts; |
---|
| 6 | use LATMOS::Accounts::Mail; |
---|
| 7 | use Getopt::Long; |
---|
| 8 | use Pod::Usage; |
---|
| 9 | use YAML; |
---|
| 10 | |
---|
| 11 | =head1 NAME |
---|
| 12 | |
---|
| 13 | la-test-mail - Send mail using LATMOS::Accounts config for testing purpose |
---|
| 14 | |
---|
| 15 | =head1 SYNOPSIS |
---|
| 16 | |
---|
| 17 | la-test-mail templatename email@address |
---|
| 18 | |
---|
| 19 | =head1 DESCRIPTION |
---|
| 20 | |
---|
| 21 | A tools to test mail, especially custom template. |
---|
| 22 | |
---|
| 23 | =cut |
---|
| 24 | |
---|
| 25 | GetOptions( |
---|
| 26 | 'c|config=s' => \my $config, |
---|
| 27 | 'help' => sub { pod2usage(0) }, |
---|
| 28 | 'var=s' => \my $varsfile, |
---|
| 29 | ) or pod2usage(); |
---|
| 30 | |
---|
| 31 | =head1 OPTIONS |
---|
| 32 | |
---|
| 33 | =over 4 |
---|
| 34 | |
---|
| 35 | =item -c|--config configdir |
---|
| 36 | |
---|
| 37 | Use this configuration directory instead of the default one. |
---|
| 38 | |
---|
| 39 | =item --var yaml-file |
---|
| 40 | |
---|
| 41 | An optional path to YAML file containing variable to use to fill template |
---|
| 42 | placeholders |
---|
| 43 | |
---|
| 44 | =back |
---|
| 45 | |
---|
| 46 | =cut |
---|
| 47 | |
---|
| 48 | my $vars = {}; |
---|
| 49 | if ($varsfile) { |
---|
| 50 | $vars = YAML::LoadFile($varsfile) or die "Cannot load $varsfile\n"; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | my $LA = LATMOS::Accounts->new($config, noacl => 1); |
---|
| 54 | |
---|
| 55 | my $lamail = LATMOS::Accounts::Mail->new($LA, $ARGV[0]); |
---|
| 56 | |
---|
[1011] | 57 | $lamail->process({ to => $ARGV[1] }, $vars); |
---|
Note: See
TracBrowser
for help on using the repository browser.