Project

General

Profile

Intercepting Emails on dev environnement

Added by Jean Bertrand almost 8 years ago

Hi !
I try to follow the Rails documentation to intercept email on dev and staging environement

http://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails

But it doesn't complatly works, the mail is send to but also to the original recipient.

When I use byebug just in the first line of the self.delivering_email method message.to is empty.

[1, 7] in /Users/jbertrand/workspace/redmine_silicon/lib/mail_interceptor.rb
   1: class MailInterceptor
   2:   def self.delivering_email(message)
   3:     byebug
=> 4:     message.subject = "[for: #{message.to.to_s} from: #{message.from.to_s}] #{message.subject}" 
   5:     message.to      = ['test+redmine@siliconsalad.com']
   6:   end
   7: end
(byebug) message.to
(byebug) message.to.inspect
[]


# RAILS_ENV=development bin/about
Environment:
  Redmine version                3.2.1.stable
  Ruby version                   2.2.1-p85 (2015-02-26) [x86_64-darwin14]
  Rails version                  4.2.5.2
  Environment                    development
  Database adapter               Mysql2
SCM:
  Subversion                     1.7.20
  Git                            2.5.4
  Filesystem
Redmine plugins:
  a_common_libs                  2.1.6
  csv_import_issues              0.0.2
  easy_baseline                  1.2
  easy_gantt                     1.3
  easy_gantt_pro                 1.3
  mega_calendar                  1.3.1
  progressive_projects_list      2.0.1
  redmine_agile                  1.4.0
  redmine_checklists             3.1.3
  redmine_github_hook            2.2.0
  redmine_hipchat                2.0.0
  redmine_monitoring_controlling 0.1.1
  redmine_omniauth_google        0.0.1
  redmine_people                 1.2.0
  redmine_s3                     0.0.3
  redmine_theme_changer          0.2.0
  timelog_timer                  2.0.0
  usability                      2.1.2