My current settings are not working, but i have never tried to set this up before. Just using email for action creation, confirmation emails. Here are the settings I have now:

  config.action_mailer.perform_caching = false
  config.action_mailer.raise_delivery_errors = true
  host = 'id.mutantegg.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp.us.opalstack.com',
    :port           => '465',
    :authentication => :login,
    :user_name      => ENV['SENDGRID_USERNAME'],
    :password       => ENV['SENDGRID_PASSWORD'],
    :domain         => 'mutantegg.com',
    :enable_starttls_auto => true
  }

But I am getting this error:

Errno::ECONNREFUSED in UsersController#create
Connection refused - connect(2) for 127.0.0.1:25

I have tried plain text user name and pwd to skip the possibility of the env vars not being set, but the same error persists.

Thanks in advance

Howard

  • sean replied to this.

    hms The problem doesn't seem to be the username and password. The problem seems to be that your app is connecting to 127.0.0.1:25 instead of smtp.us.opalstack.com:465.

    Please check the rest of your app's environment to ensure that you're running with the correct environment and config (ie production vs development).

    • hms replied to this.

      sean Thanks. That helped. I moved the above block into environment.rb (instead of production.rb) and it gets further now. I get a 500 error now after a long time, probably some kind of timeout? If I use port 465 and I enable ssl I can get past the 500 error and I get an authentication error, but I know the credentials I am using are valid.
      535 5.7.8 Error: authentication failed: authentication failure

      • sean replied to this.

        hms Please try using TLS on port 587, eg:

          ActionMailer::Base.smtp_settings = {
            :address        => 'smtp.us.opalstack.com',
            :port           => '587',
            :tls            => true,
            :authentication => :login,
            :user_name      => ENV['SENDGRID_USERNAME'],
            :password       => ENV['SENDGRID_PASSWORD'],
            :domain         => 'mutantegg.com',
          }

        If that doesn't work then please email Opalstack support with the app details so that we can look into it more closely.

        • hms replied to this.

          sean Thanks, I will send support a message. With the above settings I get this response:
          SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

          Mastodon