Websoft9Archive / ansible-canvas

Automatic depoyment & installation for Canvas LMS on Linux
Other
1 stars 3 forks source link

Can not send mail by SMTP #3

Open chendelin1982 opened 3 years ago

chendelin1982 commented 3 years ago

Describe the bug

All SMTP setting is correct, but I can not send mail by SMTP

Deployment method

Bug source

System Environment

Application Version

e.g v4.5

OS

Cloud PlatForm

Bug reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Bug reports

Bug Context

Bug context includes bug error, error logs and service status, it is very important for resolving issue

# bug error
(paste here) 

# service status 
(paste here) 

# error logs
(paste here) 

Bug Screenshot

paste screenshot here

Your suggestion

The reason of Bug

You can describe the reason if you have found it

Your solution for Bug

You can describe your solution here

Additional context

You can add any other context about the problem here.

chendelin1982 commented 3 years ago

SMTP on Hongkong instance work well

dubbofeng commented 3 years ago

I have put a test script test.rb in /opt/canvaslms/apps/canvaslms/htdoc

The content is `msgstr = <<END_OF_MESSAGE From: name from@example.com To: to name to@example.com Subject: test message Date: Wed, 10 Mar 2021 16:46:43 +1100 Message-Id: unique.message.id.string@example.com

This is a test message. END_OF_MESSAGE require 'net/smtp' Net::SMTP.start('smtp_server', 587, 'smtp_server', 'email_username', 'email_password', :plain) do |smtp| smtp.send_message msgstr, 'from_email', 'to_email' puts caller end`

and run: ruby test.rb

The email can be sent successfully.

Send email script refers to this document: https://ruby-doc.org/stdlib-2.5.3/libdoc/net/smtp/rdoc/Net/SMTP.html

dubbofeng commented 3 years ago

In Hongkong server, I also need to uncomment this line to be able to send email:

/opt/canvaslms/apps/canvaslms/htdocs/config/environments/production.rb line 49

config.action_mailer.raise_delivery_errors = true