我正在使用 Rails 3.2.5 和 exception_notification gem。在生产模式下,我通常使用 PostMarkApp 的 postmark-rails gem 发送电子邮件。
最初,我从 exception_notification gem 中得到一个查看错误,说明
ActionView::Template::Error (code converter not found (UTF-8 to UTF-16))
gem 'exception_notification', git: 'git://github.com/alanjds/exception_notification.git'
这解决了那个错误。现在,我希望 gem 从我的 gmail 帐户发送电子邮件,而不是使用 PostMarkApp 积分,因此我将以下内容添加到我的 production.rb 中,但异常通知尝试仅从 Post Mark App 发送电子邮件。为什么这个设置不起作用?
config.middleware.use ExceptionNotifier,
sender_address: 'noreply@mydomain.com',
exception_recipients: 'myemail@mydomain.com',
sections: %w{current_user} + ExceptionNotifier::Notifier.default_sections,
ignore_crawlers: %w{Googlebot bingbot},
email_format: true,
normalize_subject: true,
smtp_settings: {
:address => "smtp.gmail.com",
:port => "587",
:domain => "www.gmail.com",
:user_name => "myemail@gmail.com",
:password => "mypassword",
:authentication => "plain",
:enable_starttls_auto => true,
:openssl_verify_mode => 'none'
}
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_key => "_____" }