clean up previous commit

This commit is contained in:
Sam 2018-07-31 14:50:02 +10:00
parent b55d9e63a0
commit f0c203a5cf

View File

@ -63,8 +63,7 @@ task 'emails:test', [:email] => [:environment] do |_, args|
smtp = Discourse::Application.config.action_mailer.smtp_settings
if smtp[:address].match(/smtp\.gmail\.com/)
puts "
puts <<~STR
#{smtp}
============================== WARNING ==============================
@ -74,7 +73,7 @@ Sending with G Suite might work, but it is not recommended. For information see:
https://meta.discourse.org/t/dscourse-aws-ec2-g-suite-troubleshoting/62931?u=pfaffman
========================= CONTINUING TEST ============================
"
STR
end
puts "Testing sending to #{email} using #{smtp[:user_name]}:#{smtp[:password]}@#{smtp[:address]}:#{smtp[:port]}."
@ -83,24 +82,17 @@ https://meta.discourse.org/t/dscourse-aws-ec2-g-suite-troubleshoting/62931?u=pfa
.auth_login(smtp[:user_name], smtp[:password])
rescue Exception => e
if e.to_s.match(/execution expired/)
message = "
message = <<~STR
======================================== ERROR ========================================
Connection to port #{ENV["DISCOURSE_SMTP_PORT"]} failed.
====================================== SOLUTION =======================================
The most likely problem is that your server has outgoing SMTP traffic blocked.
If you are using a service like Mailgun or Sendgrid, try using port 2525.
=======================================================================================
"
STR
elsif e.to_s.match(/535/)
message = "
message = <<~STR
======================================== ERROR ========================================
AUTHENTICATION FAILED
@ -110,11 +102,10 @@ If you are using a service like Mailgun or Sendgrid, try using port 2525.
The most likely problem is that your SMTP username and/or Password is incorrect.
Check them and try again.
=======================================================================================
"
STR
j
elsif e.to_s.match(/Connection refused/)
message = "
message = <<~STR
======================================== ERROR ========================================
CONNECTION REFUSED
@ -126,11 +117,10 @@ blocking access from the Docker container.
Check the port and your networking configuration.
=======================================================================================
STR
"
elsif e.to_s.match(/service not known/)
message = "
message = <<~STR
======================================== ERROR ========================================
SMTP SERVER NOT FOUND
@ -140,11 +130,11 @@ Check the port and your networking configuration.
The most likely problem is that the host name of your SMTP server is incorrect.
Check it and try again.
=======================================================================================
STR
"
else
message = "
message = <<~STR
======================================== ERROR ========================================
UNEXPECTED ERROR
@ -155,8 +145,7 @@ This is not a common error. No recommended solution exists!
Please report the exact error message above. (And a solution, if you find one!)
=======================================================================================
"
STR
end
end
if message == "OK"
@ -171,7 +160,7 @@ Please report the exact error message above. (And a solution, if you find one!)
rescue
puts "Sending mail failed."
else
puts "
puts <<~STR
Mail accepted by SMTP server.
If you do not receive the message, check your SPAM folder
@ -180,7 +169,6 @@ or test again using a service like http://www.mail-tester.com/.
If the message is not delivered it is not a problem with Discourse.
Check the SMTP server logs to see why it failed to deliver the message.
"
STR
end
end