aboutsummaryrefslogtreecommitdiffstats
path: root/web/import.cgi
diff options
context:
space:
mode:
authormatthew <matthew>2008-11-12 21:59:43 +0000
committermatthew <matthew>2008-11-12 21:59:43 +0000
commit1a983c731beb0f6b11a366bbfa0927f2736b89b4 (patch)
tree8d8b11f47e2b5d7ca8f6b6053da3632b3168d284 /web/import.cgi
parentf109172f54cd57ad49e541bac7ce6ddfbfaf8baf (diff)
Use EvEl for /import confirmation email, as we need it to not fail due to e.g.
greylisting. Show message when getting to input screen from partial email to let user know they need to do stuff :)
Diffstat (limited to 'web/import.cgi')
-rwxr-xr-xweb/import.cgi33
1 files changed, 15 insertions, 18 deletions
diff --git a/web/import.cgi b/web/import.cgi
index 2caddffc2..4096fde9a 100755
--- a/web/import.cgi
+++ b/web/import.cgi
@@ -6,19 +6,19 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: import.cgi,v 1.7 2008-11-08 19:38:57 matthew Exp $
+# $Id: import.cgi,v 1.8 2008-11-12 21:59:43 matthew Exp $
use strict;
use Error qw(:try);
use Standard;
use mySociety::AuthToken;
-use mySociety::Email;
use mySociety::EmailUtil;
+use mySociety::EvEl;
sub main {
my $q = shift;
- my @vars = qw(service subject detail name email phone easting northing lat lon id);
+ my @vars = qw(service subject detail name email phone easting northing lat lon id phone_id);
my %input = map { $_ => $q->param($_) || '' } @vars;
my @errors;
@@ -77,11 +77,12 @@ sub main {
}
# Store for possible future use
- if ($input{id}) {
- my $already = dbh()->selectrow_array('select id from partial_user where service=? and nsid=?', {}, $input{service}, $input{id});
+ if ($input{id} || $input{phone_id}) {
+ my $id = $input{id} || $input{phone_id};
+ my $already = dbh()->selectrow_array('select id from partial_user where service=? and nsid=?', {}, $input{service}, $id);
unless ($already) {
dbh()->do('insert into partial_user (service, nsid, name, email, phone) values (?, ?, ?, ?, ?)',
- {}, $input{service}, $input{id}, $input{name}, $input{email}, $input{phone});
+ {}, $input{service}, $id, $input{name}, $input{email}, $input{phone});
}
}
@@ -104,21 +105,17 @@ sub main {
service => $input{service},
);
- my $body = mySociety::Email::construct_email({
+ my $sender = mySociety::Config::get('CONTACT_EMAIL');
+ $sender =~ s/team/fms-DO-NOT-REPLY/;
+ mySociety::EvEl::send({
_template_ => $template,
_parameters_ => \%h,
To => $input{name} ? [ [ $input{email}, $input{name} ] ] : $input{email},
- From => [ mySociety::Config::get('CONTACT_EMAIL'), 'FixMyStreet' ],
- });
-
- my $result = mySociety::EmailUtil::send_email($body, mySociety::Config::get('CONTACT_EMAIL'), $input{email});
- if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) {
- dbh()->commit();
- print 'SUCCESS';
- } else {
- dbh()->rollback();
- print 'ERROR:Could not send email';
- }
+ From => [ $sender, 'FixMyStreet' ],
+ }, $input{email});
+
+ dbh()->commit();
+ print 'SUCCESS';
}
Page::do_fastcgi(\&main);