2016-10-19 03:11:36 +00:00
|
|
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2015-08-28 00:53:14 +00:00
|
|
|
class Channel::Driver::Sendmail
|
|
|
|
def send(_options, attr, notification = false)
|
2012-12-24 13:55:43 +00:00
|
|
|
|
|
|
|
# return if we run import mode
|
|
|
|
return if Setting.get('import_mode')
|
|
|
|
|
2018-09-13 07:09:05 +00:00
|
|
|
# set system_bcc of config if defined
|
|
|
|
system_bcc = Setting.get('system_bcc')
|
|
|
|
if system_bcc.present? && system_bcc =~ /@/
|
|
|
|
attr[:bcc] ||= ''
|
|
|
|
attr[:bcc] += ', ' if attr[:bcc].present?
|
|
|
|
attr[:bcc] += system_bcc
|
|
|
|
end
|
|
|
|
|
2014-12-29 23:25:57 +00:00
|
|
|
mail = Channel::EmailBuild.build(attr, notification)
|
2016-12-02 11:24:00 +00:00
|
|
|
mail.delivery_method delivery_method
|
2013-06-12 15:59:58 +00:00
|
|
|
mail.deliver
|
2012-04-13 13:51:10 +00:00
|
|
|
end
|
2016-12-02 11:24:00 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def delivery_method
|
|
|
|
return :test if Rails.env.test?
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2016-12-02 11:24:00 +00:00
|
|
|
:sendmail
|
|
|
|
end
|
2013-06-12 15:59:58 +00:00
|
|
|
end
|