From 1a159de36f4faa7dde4a701ec4bd61510eb80306 Mon Sep 17 00:00:00 2001 From: T Date: Wed, 10 Feb 2021 15:42:21 +0000 Subject: [PATCH] tasks/emails.rake: catch exception and puts message (#12024) * tasks/emails.rake: catch exception and puts message * add username and auth --- lib/tasks/emails.rake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tasks/emails.rake b/lib/tasks/emails.rake index 45194afbfd4..4f16571030f 100644 --- a/lib/tasks/emails.rake +++ b/lib/tasks/emails.rake @@ -78,7 +78,7 @@ task 'emails:test', [:email] => [:environment] do |_, args| STR end - puts "Testing sending to #{email} using #{smtp[:address]}:#{smtp[:port]}." + puts "Testing sending to #{email} using #{smtp[:address]}:#{smtp[:port]}, username:#{smtp[:user_name]} with #{smtp[:authentication]} auth." # We would like to do this, but Net::SMTP errors out using starttls #Net::SMTP.start(smtp[:address], smtp[:port]) do |s| @@ -169,8 +169,9 @@ task 'emails:test', [:email] => [:environment] do |_, args| begin puts "Sending to #{email}. . . " Email::Sender.new(TestMailer.send_test(email), :test_message).send - rescue + rescue => error puts "Sending mail failed." + puts error.message else puts <<~STR Mail accepted by SMTP server.