用于Google Compute Engine的配置rails3 actionMailer超时 [英] Configuration rails3 actionMailer for Google Compute Engine times out

查看:106
本文介绍了用于Google Compute Engine的配置rails3 actionMailer超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取:

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

GCE需要sendgrid并遵循有指示我将端口修改为"2525根据 GCE的文档.所以environment.rb文件是

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!

环境变量在yaml文件中定义为

The environment variables are defined in a yaml file with

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

developing.rb定义它仍处于开发模式

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?

假设连接不良

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

在您的development.rb中的

推荐答案

尝试将 config.action_mailer.default_url_options 修改为:

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

这篇关于用于Google Compute Engine的配置rails3 actionMailer超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆