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ヘルパーを持っていて、hrefとして "@user"を使っていました。ありがとうございました – kcurtin