system_mailer.rb 635 B

1234567891011121314151617181920
  1. class SystemMailer < ActionMailer::Base
  2. default :from => ENV['EMAIL_FROM_ADDRESS'].presence || 'you@example.com'
  3. def send_message(options)
  4. @groups = options[:groups]
  5. @headline = options[:headline]
  6. @body = options[:body]
  7. mail_options = { to: options[:to], subject: options[:subject] }
  8. mail_options[:from] = options[:from] if options[:from].present?
  9. if options[:content_type].present?
  10. mail(mail_options) do |format|
  11. format.text if options[:content_type] == "text/plain"
  12. format.html if options[:content_type] == "text/html"
  13. end
  14. else
  15. mail(mail_options)
  16. end
  17. end
  18. end