0
我包括从我的heroku应用程序发送的电子邮件中的链接。我遵循ActionMailer railscast,并且在开发过程中一切都运行良好,但是当使用heroku/sendgrid时,链接将在没有主机的情况下发送。例如,而不是http://www.reelify.com/users/2条链接就是http://users/2ActionMailer链接主机失败的导轨3.1和heroku
这是我在初始化为setup_mail.rb:
require 'development_mail_interceptor'
if Rails.env.production?
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => 'XXX',
:password => 'XXX',
:domain => 'heroku.com'
}
else
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "reelify.com",
:user_name => "XXX",
:password => "XXX",
:authentication => "plain",
:enable_starttls_auto => true
}
end
ActionMailer::Base.default_url_options[:host] = "reelify.com"
ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
我也尝试加入这一行我production.rb但现在被注释掉而我测试:
config.action_mailer.default_url_options = { :host => 'reelify.com' }
任何有什么想法?
啊我明白了,这是正是我在做什么。我有一个link_to助手,并使用“@user”作为href。谢谢 – kcurtin 2012-04-03 14:15:12