Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. class DevelopmentMailInterceptor
  2. OPAL_EMAIL_PATTERN = %r(workwithopal)
  3.  
  4. def self.delivering_email(message)
  5. if message.to.any? {|recipient| recipient =~ OPAL_EMAIL_PATTERN }
  6. # If an Opal employee, still CC original TO email address
  7. message.cc = message.to.select{|recipient| recipient =~ OPAL_EMAIL_PATTERN }
  8. message.subject << " (sent to #{message.to.join(', ')} from #{Rails.env.upcase})"
  9. else
  10. message.subject << " (interecepted for #{message.to.join(', ')} from #{Rails.env.upcase})"
  11. end
  12. if message.to.any? {|recipient| recipient =~ OPAL_EMAIL_PATTERN } && Rails.env.staging?
  13. return true
  14. else
  15. message.to = "devtest+#{Rails.env.to_s.downcase.strip}@workwithopal.com"
  16. end
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement