tasks/emails.rake: catch exception and puts message (#12024)
* tasks/emails.rake: catch exception and puts message * add username and auth
This commit is contained in:
parent
ad7ca46231
commit
1a159de36f
|
@ -78,7 +78,7 @@ task 'emails:test', [:email] => [:environment] do |_, args|
|
||||||
STR
|
STR
|
||||||
end
|
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
|
# We would like to do this, but Net::SMTP errors out using starttls
|
||||||
#Net::SMTP.start(smtp[:address], smtp[:port]) do |s|
|
#Net::SMTP.start(smtp[:address], smtp[:port]) do |s|
|
||||||
|
@ -169,8 +169,9 @@ task 'emails:test', [:email] => [:environment] do |_, args|
|
||||||
begin
|
begin
|
||||||
puts "Sending to #{email}. . . "
|
puts "Sending to #{email}. . . "
|
||||||
Email::Sender.new(TestMailer.send_test(email), :test_message).send
|
Email::Sender.new(TestMailer.send_test(email), :test_message).send
|
||||||
rescue
|
rescue => error
|
||||||
puts "Sending mail failed."
|
puts "Sending mail failed."
|
||||||
|
puts error.message
|
||||||
else
|
else
|
||||||
puts <<~STR
|
puts <<~STR
|
||||||
Mail accepted by SMTP server.
|
Mail accepted by SMTP server.
|
||||||
|
|
Loading…
Reference in New Issue