Hardik
Hardik

Reputation: 3895

Rails Net::OpenTimeout - execution expired: when sending mail

When sending mail in Rails using ActionMailer I am getting following error:

Completed 500 Internal Server Error in 5222.3ms

OpenSSL::SSL::SSLError - SSL_read: wrong version number:

My setting in development.rb:

config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  ActionMailer::Base.default :from => Settings.mail.alerts
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address => "smtp.live.com",
      :port => 587,
      :domain => "xyz.in",
      :user_name => "[email protected]",
      :password => "my_password",
      :authentication => "plain",
      :enable_starttls_auto => true
  }

I am stuck on this issue for 4 days. Any help would be appreciated. here is the full stack-trace

EDIT

mail gem => actionmailer (3.2.17)

Settings.mail.alerts => '[email protected]'

And If I use any other provider like gmail it's working fine but in this case only it is showing this error.

Upvotes: 1

Views: 8932

Answers (1)

sesperanto
sesperanto

Reputation: 187

Add configuration:

ssl: true

Test:

config.action_mailer.smtp_settings = {
      :address => "smtp.live.com",
      :port => 587,
      :domain => "xyz.in",
      :user_name => "[email protected]",
      :password => "my_password",
      :authentication => "plain",
      :enable_starttls_auto => true,
      :ssl => true
  }

Upvotes: 1

Related Questions