#!/usr/bin/perl use strict; use warnings; use LATMOS::Accounts; use LATMOS::Accounts::Mail; use Getopt::Long; use Pod::Usage; use YAML; =head1 NAME la-test-mail - Send mail using LATMOS::Accounts config for testing purpose =head1 SYNOPSIS la-test-mail templatename email@address =head1 DESCRIPTION A tools to test mail, especially custom template. =cut GetOptions( 'c|config=s' => \my $config, 'help' => sub { pod2usage(0) }, 'var=s' => \my $varsfile, ) or pod2usage(); =head1 OPTIONS =over 4 =item -c|--config configdir Use this configuration directory instead of the default one. =item --var yaml-file An optional path to YAML file containing variable to use to fill template placeholders =back =cut my $vars = {}; if ($varsfile) { $vars = YAML::LoadFile($varsfile) or die "Cannot load $varsfile\n"; } my $LA = LATMOS::Accounts->new($config, noacl => 1); my $lamail = LATMOS::Accounts::Mail->new($LA, $ARGV[0]); $lamail->process({ to => $ARGV[1] }, $vars);