diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-11-23 13:39:48 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-11-23 18:00:52 +0000 |
commit | d191b211cc25c60d2a1464711ff4212f4d4a5e6e (patch) | |
tree | e510e580ab8336b3b8a819095b8456d36819c5cd /bin/handlemail-support | |
parent | 755910d87c36c1ec4e6b8216cf50954fbd93b783 (diff) |
Use standard email sending for handlemail.
The EmailUtil library expects "\n" line endings, otherwise it gets
confused. It also doesn't handle a different SMTP port, and so on.
We also make sure the return path is chomped.
Diffstat (limited to 'bin/handlemail-support')
-rwxr-xr-x | bin/handlemail-support | 15 |
1 files changed, 8 insertions, 7 deletions
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; |