Not able to send email Net::ReadTimeout

(Andrey) #1

I installed discourse behind nginx according this post. Also I have SSL certificate installed by certboot
Registration activation email is not sending and when I run ./discourse-doctor on email sending step I get

However, everything is OK with curl. I send message on the same port (465) and receive message.
My settings are:

- "templates/web.socketed.template.yml"

(Jay Pfaffman) #2

Try using port 2525.

(Andrey) #3

No success. Got this
======================================== ERROR ========================================

Connection to port 2525 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.

update: curl also fails on 2525

(Stephen) #4

Are you on DigitalOcean? They are known to block outbound mail ports on new servers, particularly on new accounts.

Reach out to them to get it unblocked if so, but use 587 if possible! 465 was revoked by the IETF years ago.

(Andrey) #5

Not DigitalOcean. I use other Ubuntu VPS and Yandex as smtp server.
Curl fails on 25, 2525 and 587 ports, but works on 465

(Stephen) #6

Either way sounds like your provider is blocking you. Definitely worth reaching out to get the restriction removed.

(Andrey) #7

I am able to connect to smtp server via telnet on ports 25, 587 and 465. So, I don’t think someone blocks ports.

(Andrey) #8

The Question is why am I getting ReadTimeout with Discourse while with curl I can successfully send message (on 465 port)

(Jay Pfaffman) #9

Try from inside the container.

./launcher enter app 

You may have docker blocked from getting outside.

(Stephen) #10

Or whichever host is conducting traffic inspection, which would explain why it works until you wrap it in TLS.

(Andrey) #11

Tried from within docker. Successfully sent with curl

root@server-app:/var/www/discourse# curl --url 'smtps://' --ssl-reqd \
   --mail-from '...' --mail-rcpt '...' \
   --upload-file mail1.txt --user 'login:pass'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   167    0     0  100   167      0    166  0:00:01  0:00:01 --:--:--   167

(Andrey) #12

What else can I try to make it work?

I checked logs and found nothing interesting
In production.log:

   Started PUT "/finish-installation/resend-email" for ip at 2018-10-01 19:22:45 +0000
Processing by FinishInstallationController#resend_email as HTML
  Parameters: {"authenticity_token"=>"..."}
  Rendering finish_installation/resend_email.html.erb within layouts/finish_installation
  Rendered finish_installation/resend_email.html.erb within layouts/finish_installation (0.8ms)
  Rendered common/_special_font_face.html.erb (0.2ms)
  Rendered layouts/_head.html.erb (0.3ms)
Completed 200 OK in 23ms (Views: 2.5ms | ActiveRecord: 3.6ms)

I manually activated account with

rake admin:create

and in sidekiq section I see this:

{"type"=>"signup", "user_id"=>1, "email_token"=>"...", "current_site_id"=>"default"} Jobs::HandledExceptionWrapper: Wrapped ArgumentError: wrong authentication type none

Problem with docker installation