0

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{my_email@gmail.com}
   }   

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???

kai
  • 492
  • 3
  • 18
  • I couldn't find a newer document. I don't think much has changed. Please see here: http://gmailblog.blogspot.com/2009/07/send-mail-from-another-address-without.html – vee Feb 11 '15 at 09:16

3 Answers3

3

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.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
  • I change username "my_email@domain.com" and domain.com is my custom gmail apps mail. and It also sender is my email_address. :( – kai Feb 11 '15 at 09:42
  • and then how to change and send norepy@doamin.com ? – kai Feb 12 '15 at 01:28
0

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" <notifier@myApp.com>},
     :exception_recipients => %w{your_desired_email@gmail.com}
   }

i works for me....

Milind
  • 4,535
  • 2
  • 26
  • 58
  • It Also not change sender address... mailUser name is change ("Noreply ") i will try more :) – kai Feb 11 '15 at 10:05
0

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

 :sender_address => %{"Username" <useremailid@xyzmail.com>},