source: trunk/LATMOS-Accounts/bin/la-test-mail @ 2380

Last change on this file since 2380 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
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use LATMOS::Accounts::Mail;
7use Getopt::Long;
8use Pod::Usage;
9use 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
21A tools to test mail, especially custom template.
22
23=cut
24
25GetOptions(
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
37Use this configuration directory instead of the default one.
38
39=item --var yaml-file
40
41An optional path to YAML file containing variable to use to fill template
42placeholders
43
44=back
45
46=cut
47
48my $vars = {};
49if ($varsfile) {
50    $vars = YAML::LoadFile($varsfile) or die "Cannot load $varsfile\n";
51}
52
53my $LA = LATMOS::Accounts->new($config, noacl => 1);
54
55my $lamail = LATMOS::Accounts::Mail->new($LA, $ARGV[0]);
56
57$lamail->process({ to => $ARGV[1] }, $vars);
Note: See TracBrowser for help on using the repository browser.