9

I am using actionmailer to send registration verification details of devise to users but I am getting following error:

Net::OpenTimeout in Users::RegistrationsController#create

my development.rb looks like:

config.action_mailer.default_url_options = { :host => 'http://localhost:3000' }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
 :address => 'smtp.gmail.com',
 :port => 25,
 :domain => 'gmail.com',
 :user_name => 'example@gmail.com',
 :password => 'secret',
 :authentication => 'plain',
 :enable_starttls_auto => true,
 :ssl => true
 }

I use this question and added

#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

command:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

return 1. It didn't make difference to my error. Also tried changing port from 587 to 2525. So I tried establish connection with server from command line:

telnet smtp.gmail.com 2525

got:

Trying 74.125.68.108...
Trying 74.125.68.109...
Trying 2404:6800:4003:c02::6c...
telnet: Unable to connect to remote host: Network is unreachable

I even tried adding firewall rules using this. I followed second method (ufw) but I am still getting same error.

Community
  • 1
  • 1
sonalkr132
  • 967
  • 1
  • 9
  • 25
  • 1
    Did you try `telnet smtp.gmail.com 587`? – Substantial Oct 19 '14 at 07:26
  • yup. /etc/services has: `telnet 23/tcp`. I tried that too but everthing leads to `telnet: Unable to connect to remote host: Network is unreachable` – sonalkr132 Oct 19 '14 at 08:00
  • Di dyou ever figure this out? – ashes999 Jan 19 '15 at 22:44
  • nope! I am using heroku for hosting and there email settings seem to work fine but locally it doesn't work. I guess it has something to do with my ISP – sonalkr132 Jan 24 '15 at 04:43
  • I suppose email settings are correct but make sure port 23, 587 & 25 are open on heroku. – Anuj Sep 16 '15 at 09:20
  • you mentioned this isn't working locally but does work on heroku. Can you access your personal gmail account over SMTP (i.e. with a mail client) over this connection? It sounds like your ISP may be blocking ports or something... – BM5k Jun 19 '18 at 22:02

0 Answers0