diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-02-06 16:10:52 +0000 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-02-06 16:10:52 +0000 |
commit | 5e303982d7e9a675103ba9dedf65d69b7b46d968 (patch) | |
tree | 2cd7f4f0e98ff6f7bb17b891b267c736fe5c3449 /perllib/Page.pm | |
parent | e78992ffffa8fb03d70fc465806b0ced788d723f (diff) |
Added (temporary) alternative to sending email out through EvEl
Diffstat (limited to 'perllib/Page.pm')
-rw-r--r-- | perllib/Page.pm | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 817a56761..833cd6da9 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -14,6 +14,7 @@ package Page; use strict; use Carp; use mySociety::CGIFast qw(-no_xhtml); +use Data::Dumper; use Error qw(:try); use File::Slurp; use HTTP::Date; # time2str @@ -402,13 +403,29 @@ sub send_email { my $sender = Cobrand::contact_email($cobrand); my $sender_name = Cobrand::contact_name($cobrand); $sender =~ s/team/fms-DO-NOT-REPLY/; - mySociety::EvEl::send({ - _template_ => _($template), - _parameters_ => \%h, - From => [ $sender, _($sender_name)], - To => $to, - }, $email); + # only try to send via EvEl if url configured - otherwise just print a + # warning regarding the message contents. + my @evel_args = ( + { + _template_ => _($template), + _parameters_ => \%h, + From => [ $sender, _($sender_name) ], + To => $to, + }, + $email + ); + + if ( mySociety::Config::get('EVEL_URL') ) { + mySociety::EvEl::send( $evel_args[0], $evel_args[1] ); # sub is prototyped... + } + else { + warn "Config EVEL_URL is false - not sending email but warning instead.\n"; + warn "These are the args to mySociety::EvEl::send(...):\n"; + warn Dumper( \@evel_args ); + warn " "; # so line number gets into error log + } + my ($action, $worry); if ($thing eq 'problem') { $action = _('your problem will not be posted'); |