0

ExceptionNotifier Gem を使用した Rails アプリケーション

構成ファイルを変更します

例外メールは正常に機能しています

ただし、送信者のメールは Noreply < noreply@our_domain.com > ではありません。

送信者は常に私のメールアドレスです

私の production.rb ファイルは

config.log_formatter = ::Logger::Formatter.new

config.middleware.use ExceptionNotification::Rack,
   :email => {
     :email_prefix => "[Exception ",
     :sender_address => %{"Noreply" <noreply@our_domain.com>},
     :exception_recipients => %w{my_email@gmail.com}
   }   

そしてsetup_mailer.rbファイルは

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "our_domain.com",
  :user_name => "my_eamail@our_domain.com",
  :password => "PASSWORD",
  :authentication => "login",
  :enable_starttls_auto => true

} 

送信者アドレスが変更されないのはなぜですか???

4

3 に答える 3

3

Gmail SMTP アカウントを使用して認証する場合、Gmail は送信者を Gmail アカウントに上書きします。SMTP を使用して別のドメインからメールを送信することは許可されていません。

于 2015-02-11T09:33:02.687 に答える
0

以下のコードを試してproduction.rb(本番環境で作業したい場合)、ハードコードしてください....

 ##added exception notification gem
 MyApp::Application.config.middleware.use ExceptionNotification::Rack,
   :email => {
     :email_prefix => "[MyApp_Error] ",
     :sender_address => %{"notifier" <notifier@myApp.com>},
     :exception_recipients => %w{your_desired_email@gmail.com}
   }

私は私のために働いています....

于 2015-02-11T09:45:45.153 に答える