I'm using sidekiq to to queue the emails my Rails application will send. Sending emails works in development, but in production sidekiq will get a network timeout error. What's going on?
Here's my config in production.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 578,
domain: ENV["PPRODUCTION_DOMAIN"],
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"],
authentication: :plain,
enable_starttls_auto: true
}
config.active_job.queue_adapter = :sidekiq
I have tried the following:
telnet smtp.gmail.com 587
. I get the following error: telnet: Unable to connect to remote host: Network is unreachable
. It might be worth noting that I'm operating behind a proxy - should there be an additional setup in this case?sudo ufw allow 587
I'm on an Ubuntu 14.04 server and have set up my app using unicorn and nginx.
I've been at this for days. :( Any help would be greatly appreciated!
Update:
I also tried the following:
telnet smtp.gmail.com 465
. This one works so I tried setting the port in production to 465, but I still get the same error.localhost:3000
. Nothing happens.Somehow fixed it by changing the port to 456
instead.
I changed the port because for some reason, telnet smtp.gmail.com 587
doesn't work but telnet smtp.gmail.com 465
does. 587
may have been blocked by the network.
Also, I'm not sure if the following changes also helped, but I also changed the authentication to :login
instead of :plain
and added ssl: true
. Hope this helps out anyone who encounters the same problem.