aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-02-06 16:10:52 +0000
committerEdmund von der Burg <evdb@mysociety.org>2011-02-06 16:10:52 +0000
commit5e303982d7e9a675103ba9dedf65d69b7b46d968 (patch)
tree2cd7f4f0e98ff6f7bb17b891b267c736fe5c3449
parente78992ffffa8fb03d70fc465806b0ced788d723f (diff)
Added (temporary) alternative to sending email out through EvEl
-rw-r--r--notes/INSTALL4
-rw-r--r--notes/glossary.txt6
-rw-r--r--perllib/Page.pm29
3 files changed, 31 insertions, 8 deletions
diff --git a/notes/INSTALL b/notes/INSTALL
index 7efdad39e..627dd9098 100644
--- a/notes/INSTALL
+++ b/notes/INSTALL
@@ -64,7 +64,6 @@ sudo apache2ctl restart
cd -
# You may need to change the permissions on your files so that apache can read them
-# sudo chgrp -Rc www-data ~/fixmystreet
# SETTING UP CONFIG FILES
@@ -76,7 +75,7 @@ nano conf/general
# You only need to alter:
# * the database connection details
# * the OPTION_BASE_URL to be where your test site will run - eg 'http://localhost'
-
+# * the OPTION_EVEL_URL to '' - this will cause some emails not to be sent but warned to STDERR instead - proper email handling is being worked on
# SETTING UP THE DATABASES
@@ -90,6 +89,7 @@ exit
createdb -E SQL_ASCII bci
createlang plpgsql bci
psql bci < db/schema.sql
+psql bci < db/alert_types.sql
# LOOK AT THE SITE IN YOUR BROWSER
diff --git a/notes/glossary.txt b/notes/glossary.txt
index 82b09bdf1..0c533a944 100644
--- a/notes/glossary.txt
+++ b/notes/glossary.txt
@@ -4,3 +4,9 @@ Unfamiliar terms that you may come across in the code:
BCI: Broken Civic Infrastructure - project name before it became FixMyStreet -
still to be found used in some config variable names
+MaPit: The mySociety database and web service that maps postcodes and points to
+current or past administrative area information and polygons for all the United
+Kingdom. http://mapit.mysociety.org/
+
+EvEl: A generic email sending and mailing list functionality, with bounce
+detection: https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/EvEl
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');