trabajo-afectivo/app/models/channel/driver/sendmail.rb

31 lines
787 B
Ruby
Raw Normal View History

2016-10-19 03:11:36 +00:00
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
2015-08-28 00:53:14 +00:00
class Channel::Driver::Sendmail
def send(_options, attr, notification = false)
# return if we run import mode
return if Setting.get('import_mode')
# set system_bcc of config if defined
system_bcc = Setting.get('system_bcc')
email_address_validation = EmailAddressValidation.new(system_bcc)
if system_bcc.present? && email_address_validation.valid_format?
attr[:bcc] ||= ''
attr[:bcc] += ', ' if attr[:bcc].present?
attr[:bcc] += system_bcc
end
mail = Channel::EmailBuild.build(attr, notification)
2016-12-02 11:24:00 +00:00
mail.delivery_method delivery_method
mail.deliver
end
2016-12-02 11:24:00 +00:00
private
def delivery_method
return :test if Rails.env.test?
2016-12-02 11:24:00 +00:00
:sendmail
end
end