diff options
author | Matthew Somerville <matthew@mysociety.org> | 2017-03-17 22:18:45 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-03-28 13:10:38 +0100 |
commit | b26da0da5e1f8631646a34fdacbce9bb5bc3b706 (patch) | |
tree | cd42e16d51054606b85bf6ff28a47e586437406c /perllib/FixMyStreet/App.pm | |
parent | 02fcb1606bc2b739fdc798e5ca06f2ed1b6bf6ea (diff) |
Upgrade to using Email::Sender.
Email::Send is long deprecated and uses submodules that no longer work
correctly (e.g. Net::SMTP::TLS breaks with recent IO::Socket::SSL). We
create an Email::Sender subclass to perform the same functionality and
this also simplifies the email code with simpler envelope handling.
Bundle Email::Sender::Transport::SMTP to include fix from
https://github.com/rjbs/Email-Sender/issues/46
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 9660d327a..35e8c2537 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -9,9 +9,11 @@ use FixMyStreet::Cobrand; use Memcached; use FixMyStreet::Map; use FixMyStreet::Email; +use FixMyStreet::Email::Sender; use Utils; use Path::Tiny 'path'; +use Try::Tiny; use URI; use URI::QueryParam; @@ -346,8 +348,13 @@ sub send_email { $data->{_html_images_} = \@inline_images if @inline_images; my $email = mySociety::Locale::in_gb_locale { FixMyStreet::Email::construct_email($data) }; - my $return = $c->model('EmailSend')->send($email); - $c->log->error("$return") if !$return; + + try { + FixMyStreet::Email::Sender->send($email, { from => $sender }); + } catch { + my $error = $_ || 'unknown error'; + $c->log->error("$error"); + }; return $email; } |