简体   繁体   中英

“Connection refused - connect(2) for nil port 587” delivering mails from Sidekiq in staging

I tried to send many user emails from a worker using Sidekiq but when I enqueued the worker I got an error Connection refused - connect(2) for nil port 587 , doing the same process on localhost works fine.

Piece of worker code

def send_mails(users)
  users.each do |user|
     WelcomeMailer.presale_users({email: user.email}).deliver
  end
end

staging.rb

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address: ENV['SES_ADDRESS'],
  port: 587,
  domain: 'domain.com',
  user_name: ENV['SES_USER_NAME'],
  password: ENV['SES_PASSWORD']
}

It looks like address is nil .

Are your environment variables being read correctly?

Maybe try outputting them in the logger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM