aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-07-17 14:22:09 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-07-18 08:35:36 +0100
commit8abf4f67c94344dd190c02b86b34126834818635 (patch)
tree728b1ebcde7333c0cd42987cdb8f60851595fd1a /perllib
parentefb31cd406b47096ffa874e47656f3b2ef50e35f (diff)
Log error if bad SMTP_TYPE config given.
Ignore case of config variable.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Email/Sender.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Email/Sender.pm b/perllib/FixMyStreet/Email/Sender.pm
index e6148a56c..2fb819fbc 100644
--- a/perllib/FixMyStreet/Email/Sender.pm
+++ b/perllib/FixMyStreet/Email/Sender.pm
@@ -28,11 +28,14 @@ sub build_default_transport {
if ( FixMyStreet->test_mode ) {
Email::Sender::Util->easy_transport(Test => {});
} elsif ( my $smtp_host = FixMyStreet->config('SMTP_SMARTHOST') ) {
- my $type = FixMyStreet->config('SMTP_TYPE') || '';
+ my $type = lc (FixMyStreet->config('SMTP_TYPE') || '');
my $port = FixMyStreet->config('SMTP_PORT') || '';
my $username = FixMyStreet->config('SMTP_USERNAME') || '';
my $password = FixMyStreet->config('SMTP_PASSWORD') || '';
+ die "Bad SMTP_TYPE config: is $type, should be tls, ssl, or blank"
+ unless $type =~ /^(tls|ssl|)$/;
+
my $ssl = $type eq 'tls' ? 'starttls' : $type eq 'ssl' ? 'ssl' : '';
my $args = {
host => $smtp_host,