0
私はherokuにアプリケーションをデプロイしています。私はmailgunを使用しています。ここではエラーになります:Rails - mailgunを使用して本番環境で電子メールを送信できません
Exception
Net::OpenTimeout
Error
execution expired
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/net/smtp.rb:541:in `initialize'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/net/smtp.rb:541:in `open'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/net/smtp.rb:541:in `tcp_socket'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/net/smtp.rb:551:in `block in do_start'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/timeout.rb:98:in `call'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/timeout.rb:98:in `timeout'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/net/smtp.rb:550:in `do_start'
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/net/smtp.rb:520:in `start'
/app/vendor/bundle/ruby/2.2.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
/app/vendor/bundle/ruby/2.2.0/gems/mail-2.6.4/lib/mail/message.rb:253:in `deliver!'
/app/vendor/bundle/ruby/2.2.0/gems/actionmailer-4.2.5/lib/action_mailer/message_delivery.rb:77:in `deliver_now!'
/app/vendor/bundle/ruby/2.2.0/gems/actionmailer-4.2.5/lib/action_mailer/delivery_job.rb:10:in `perform'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.5/lib/active_job/execution.rb:32:in `block in perform_now'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:117:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:117:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:343:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/app/vendor/bundle/ruby/2.2.0/gems/i18n-0.8.1/lib/i18n.rb:257:in `with_locale'
、私のconfig /環境/ production.rbコード
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings =
{
:address => 'mailgun.org',
:port => ENV['MAILGUN_SMTP_PORT'],
:domain => ENV['MY_DOMAIN'],
:user_name => ENV['MAILGUN_SMTP_LOGIN'],
:password => ENV['MAILGUN_SMTP_PASSWORD'],
:authentication => 'plain'
}
config.action_mailer.default_url_options = { :host => 'https://myapp.herokuapp.com/' }
config.action_mailer.asset_host = 'https://myapp.herokuapp.com/'
config.action_controller.asset_host = 'https://myapp.herokuapp.com/'
'production.rb'に構文エラーがありますが、問題が起こっていないのですか? – Iceman
'MAILGUN_SMTP_PORT'には何を使用していますか?それが25なら、それは問題かもしれません - ここで議論ごとに587に切り替えてみてください:http://blog.mailgun.com/25-465-587-what-port-should-i-use/ – Brian
@Brian Iすでにそれを試みたが運がまだありません。 – romiesilvano