Loomio

Unable to send email

N
Naomi Public Seen by 181

Site is up and running, I get a login page, but when I try to make an account I don't receieve the confirmation email. I'm getting this error:

Job UserMailer.login (id=271) FAILED (0 prior attempts) with Net::ReadTimeout: Net::ReadTimeout with #

It is not the same as this problem : https://www.loomio.org/d/LDS3ON5a/mailserver-refuses-connection-from-inside-loomios-containers, because I can connect to, and authenticate with, the SMTP server from inside the container.

N

Naomi Fri 12 Apr 2019

Have managed to send an email on the command line from inside the container using openssl, so I know that the connection can be made and the credentials are correct. I did this:

docker exec -ti loomio-worker openssl s_client -connect <SMTP_SERVER>:<SMTP_PORT>
then
HELO <SMTP_DOMAIN>
then I authenticated with base64 encodings of SMTP_USERNAME and SMTP_PASSWORD

Then successfully sent a email.

How might I go about further debugging this error? Is there a way to get more detailed logs?

RG

Rob Guthrie Fri 12 Apr 2019

We just use Rails ActionMailer to send email, if it's unable to connect to your smtp, then have a look here:

https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration

The ENV variables in the env file map to settings that can be found in config/application.rb.. here's the relevant piece of code:

  if ENV['SMTP_SERVER']
      config.action_mailer.delivery_method = :smtp
      config.action_mailer.smtp_settings = {
        address: ENV['SMTP_SERVER'],
        port: ENV['SMTP_PORT'],
        authentication: ENV['SMTP_AUTH'],
        user_name: ENV['SMTP_USERNAME'],
        password: ENV['SMTP_PASSWORD'],
        domain: ENV['SMTP_DOMAIN'],
        ssl: ENV['SMTP_USE_SSL'],
        openssl_verify_mode: ENV.fetch('SMTP_SSL_VERIFY_MODE', 'none')
      }.compact
    else
N

Naomi Sun 14 Apr 2019

Thanks @robertguthrie . I have checked and re-checked the config. I also tried adding SMTP_AUTH=login to the env file, as that key seemed to be missing. But I am getting the same errors and they look to me like connection errors as opposed to auth anyway (a guess). There seem to be other connection errors in the logs too.

loomio-nginx   | nginx.1    | 2019/04/14 10:43:04 [error] 90#90: *62 connect() failed (111: Connection refused) while connecting to upstream, client: 150.143.128.86, server: loomio.myserver.com, request: "GET /cable HTTP/1.1", upstream: "http://172.17.0.4:3000/cable", host: "loomio.myserver.com:444"

I'm also getting an error from mailin but I realise that's not used for sending mail, just thought it might be relevant somehow:

loomio-mailin  | warn: Webhook http://app:3000/email_processor/ seems invalid or down. You may want to double check the webhook url.

This is still on the server with other things running besides it, so if you think that could be causing these problems I will try on a dedicated one when I get a chance

RG

Rob Guthrie Sun 14 Apr 2019

You can run Loomio on servers with other things, but it's highly recommend you let loomio have all the ports it needs unless you want to "rewire" all the things. All these errors seem like broken port dependencies. So if cost isn't a barrier, definately just start again with a free VPS.

What SMTP service are you using?