aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App.pm
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-03-03 11:39:57 +0000
committerEdmund von der Burg <evdb@mysociety.org>2011-03-03 11:39:57 +0000
commitaa0d7a595c6e442ac2ef50e7041070d42d2c26e7 (patch)
tree4804186b76938fae006597724380c43e4005ca10 /perllib/FixMyStreet/App.pm
parentc47cfe2bdd85b1561b57a5bccad9a1512af1f1bb (diff)
Change emails to use construct_email from mySociety::Email for encoding and line wrapping
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r--perllib/FixMyStreet/App.pm25
1 files changed, 21 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 3e3c9c8a8..44f85aa9f 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -7,6 +7,7 @@ use FixMyStreet;
use FixMyStreet::Cobrand;
use Memcached;
use Problems;
+use mySociety::Email;
use Catalyst (
'Static::Simple', #
@@ -58,6 +59,16 @@ __PACKAGE__->config(
user_model => 'DB::User',
},
},
+ no_password => { # use post confirm etc
+ credential => { # Catalyst::Authentication::Credential::Password
+ class => 'Password',
+ password_type => 'none',
+ },
+ store => { # Catalyst::Authentication::Store::DBIx::Class
+ class => 'DBIx::Class',
+ user_model => 'DB::User',
+ },
+ },
},
);
@@ -179,16 +190,22 @@ sub send_email {
# render the template
my $content = $c->view('Email')->render( $c, $template, $vars );
- # create an email
+ # create an email - will parse headers out of content
my $email = Email::Simple->new($content);
$email->header_set( ucfirst($_), $vars->{$_} )
for grep { $vars->{$_} } qw( to from subject);
- # always send utf8 emails
- $email->header_set( 'Content-Type' => 'text/plain; charset="utf-8"' );
+ # pass the email into mySociety::Email to construct the on the wire 7bit
+ # format - this should probably happen in the transport instead but hohum.
+ my $email_text = mySociety::Email::construct_email(
+ {
+ _unwrapped_body_ => $email->body, # will get line wrapped
+ $email->header_pairs
+ }
+ );
# send the email
- $c->model('EmailSend')->send($email);
+ $c->model('EmailSend')->send($email_text);
return $email;
}