Rails4, Exception Notifier not change sender_address

209 Views Asked by At

Our Rails Application using ExceptionNotifier Gem

and change configuration file

Exception Mail is working good

But sender mail is not Noreply < noreply@our_domain.com >

Always sender is my email_address

My production.rb file is

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{[email protected]}
   }   

And setup_mailer.rb file is

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

} 

why sender address not change???

3

There are 3 best solutions below

2
Simone Carletti On BEST ANSWER

If you authenticate using the Gmail SMTP account, Gmail will override the sender to your Gmail account. They don't allow you to use their SMTP to send emails from a different domain.

1
Milind On

try below code in production.rb(Assuming you want to work in production) and hard code it....

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

i works for me....

0
Promit Neogy On

#TRY THIS in :sender_address write your own name and mail address

 :sender_address => %{"Username" <[email protected]>},