Implemented issue #2228 - Global Bcc for all outgoing emails for external archive options.
This commit is contained in:
parent
cd93bccfed
commit
54e65e5156
4 changed files with 47 additions and 0 deletions
|
@ -6,6 +6,14 @@ class Channel::Driver::Sendmail
|
|||
# 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')
|
||||
if system_bcc.present? && system_bcc =~ /@/
|
||||
attr[:bcc] ||= ''
|
||||
attr[:bcc] += ', ' if attr[:bcc].present?
|
||||
attr[:bcc] += system_bcc
|
||||
end
|
||||
|
||||
mail = Channel::EmailBuild.build(attr, notification)
|
||||
mail.delivery_method delivery_method
|
||||
mail.deliver
|
||||
|
|
|
@ -52,6 +52,15 @@ class Channel::Driver::Smtp
|
|||
if !options.key?(:openssl_verify_mode)
|
||||
options[:openssl_verify_mode] = 'none'
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
mail = Channel::EmailBuild.build(attr, notification)
|
||||
smtp_params = {
|
||||
openssl_verify_mode: options[:openssl_verify_mode],
|
||||
|
|
19
db/migrate/20180913000001_setting_add_system_bcc.rb
Normal file
19
db/migrate/20180913000001_setting_add_system_bcc.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class SettingAddSystemBcc < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
||||
Setting.create_if_not_exists(
|
||||
title: 'Bcc address for all outgoing emails',
|
||||
name: 'system_bcc',
|
||||
area: 'Email::Enhanced',
|
||||
description: 'To archive all outgoing emails from Zammad to external, you can store a bcc email address here.',
|
||||
options: {},
|
||||
state: '',
|
||||
preferences: { online_service_disable: true },
|
||||
frontend: false
|
||||
)
|
||||
end
|
||||
|
||||
end
|
|
@ -2554,6 +2554,17 @@ Setting.create_if_not_exists(
|
|||
frontend: false
|
||||
)
|
||||
|
||||
Setting.create_if_not_exists(
|
||||
title: 'Bcc address for all outgoing emails',
|
||||
name: 'system_bcc',
|
||||
area: 'Email::Enhanced',
|
||||
description: 'To archive all outgoing emails from Zammad to external, you can store a bcc email address here.',
|
||||
options: {},
|
||||
state: '',
|
||||
preferences: { online_service_disable: true },
|
||||
frontend: false
|
||||
)
|
||||
|
||||
Setting.create_if_not_exists(
|
||||
title: 'API Token Access',
|
||||
name: 'api_token_access',
|
||||
|
|
Loading…
Reference in a new issue