Configuration rails3 actionMailer for Google Compute Engine times out

孤人 提交于 2019-12-02 14:41:26

问题


Getting a:

Timeout::Error (execution expired):
  app/controllers/acts_controller.rb:192:in `send_message'

GCE requires sendgrid and following there indications I adapted the port to "2525" as per GCE's documentation. So the environment.rb file is

require File.expand_path('../application', __FILE__)

Paperclip.options[:command_path] = "/usr/bin/"

ActionMailer::Base.smtp_settings = {
  :user_name => ENV["SENDGRID_USERNAME"],
  :password => ENV["SENDGRID_PASSWORD"],
  :domain => ENV["DOMAIN"],
  :address => 'smtp.sendgrid.net',
  :port => 2525,
  :authentication => :plain,
  :enable_starttls_auto => true
}

# Initialize the rails application
Myapp::Application.initialize!

The environment variables are defined in a yaml file with

SENDGRID_USERNAME:  'my_username'
SENDGRID_PASSWORD:  'pswd'
DOMAIN:  'domain.tld'

This being still in development mode, development.rb defines

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = { :host => 'smtp.sendgrid.net' }

What could be at the source of the timeout?

EDIT: On the assumption of a bad connection

telnet smtp.sendgrid.net 2525
Trying 5.153.47.202...
Connected to smtp.sendgrid.net.

回答1:


in your development.rb try to modify the config.action_mailer.default_url_options to:

config.action_mailer.default_url_options = {
  :host => 'smtp.sendgrid.net',
  :port => 2525
}


来源:https://stackoverflow.com/questions/26851366/configuration-rails3-actionmailer-for-google-compute-engine-times-out

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!