diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/handlemail | 13 | ||||
-rwxr-xr-x | bin/handlemail-support | 15 |
2 files changed, 15 insertions, 13 deletions
diff --git a/bin/handlemail b/bin/handlemail index f85ad3e65..5a4d6e1f2 100755 --- a/bin/handlemail +++ b/bin/handlemail @@ -22,7 +22,6 @@ BEGIN { use FixMyStreet; use FixMyStreet::DB; use FixMyStreet::Email; -use mySociety::EmailUtil; use mySociety::HandleMail; use mySociety::SystemMisc qw(print_log); @@ -167,12 +166,13 @@ sub handle_non_bounce_to_null_address { $fp->close; # We generate this as a bounce. + my ($rp) = $data{return_path} =~ /^\s*<(.*)>\s*$/; my $mail = FixMyStreet::Email::construct_email({ From => [ FixMyStreet->config('CONTACT_EMAIL'), 'FixMyStreet' ], - To => $data{return_path}, + To => $rp, _body_ => $template, }); - send_mail($mail->as_string, $data{return_path}); + send_mail($mail, $rp); } sub forward_on_to { @@ -182,9 +182,10 @@ sub forward_on_to { } sub send_mail { - my ($text, $recipient) = @_; - if (mySociety::EmailUtil::EMAIL_SUCCESS - != mySociety::EmailUtil::send_email($text, '<>', $recipient)) { + my ($email, $recipient) = @_; + unless (FixMyStreet::Email::Sender->try_to_send( + $email, { from => '<>', to => $recipient } + )) { exit(75); } } diff --git a/bin/handlemail-support b/bin/handlemail-support index 0ccde8ca7..76fcb4f4e 100755 --- a/bin/handlemail-support +++ b/bin/handlemail-support @@ -22,7 +22,6 @@ BEGIN { } use FixMyStreet; -use mySociety::EmailUtil; use mySociety::HandleMail; my %data = mySociety::HandleMail::get_message(); @@ -33,12 +32,14 @@ forward_on(); sub forward_on { my ($l, $d) = split /\@/, FixMyStreet->config('CONTACT_EMAIL'); - if (mySociety::EmailUtil::EMAIL_SUCCESS - != mySociety::EmailUtil::send_email( - join("\n", @{$data{lines}}) . "\n", - $data{return_path}, - join('@', join('_deli', $l, 'very'), $d) - )) { + my ($rp) = $data{return_path} =~ /^\s*<(.*)>\s*$/; + unless (FixMyStreet::Email::Sender->try_to_send( + join("\n", @{$data{lines}}) . "\n", + { + from => $rp, + to => join('@', join('_deli', $l, 'very'), $d) + } + )) { exit 75; } exit 0; |