2017-09-08 08:28:34 +00:00
class ReplyToSenderFeature < ActiveRecord :: Migration [ 4 . 2 ]
2017-05-26 13:34:32 +00:00
def up
# return if it's a new setup
2020-08-03 08:35:43 +00:00
return if ! Setting . exists? ( name : 'system_init_done' )
2017-05-26 13:34:32 +00:00
Setting . create_if_not_exists (
2018-12-19 17:31:51 +00:00
title : 'Sender based on Reply-To header' ,
name : 'postmaster_sender_based_on_reply_to' ,
area : 'Email::Base' ,
2017-05-26 13:34:32 +00:00
description : 'Set/overwrite sender/from of email based on reply-to header. Useful to set correct customer if email is received from a third party system on behalf of a customer.' ,
2018-12-19 17:31:51 +00:00
options : {
2017-05-26 13:34:32 +00:00
form : [
{
display : '' ,
2018-12-19 17:31:51 +00:00
null : true ,
name : 'postmaster_sender_based_on_reply_to' ,
tag : 'select' ,
2017-05-26 13:34:32 +00:00
options : {
'' = > '-' ,
'as_sender_of_email' = > 'Take reply-to header as sender/from of email.' ,
'as_sender_of_email_use_from_realname' = > 'Take reply-to header as sender/from of email and use realname of origin from.' ,
} ,
} ,
] ,
} ,
2018-12-19 17:31:51 +00:00
state : '' ,
2017-05-26 13:34:32 +00:00
preferences : {
permission : [ 'admin.channel_email' ] ,
} ,
2018-12-19 17:31:51 +00:00
frontend : false
2017-05-26 13:34:32 +00:00
)
Setting . create_if_not_exists (
2018-12-19 17:31:51 +00:00
title : 'Defines postmaster filter.' ,
name : '0011_postmaster_sender_based_on_reply_to' ,
area : 'Postmaster::PreFilter' ,
2017-05-26 13:34:32 +00:00
description : 'Defines postmaster filter to set the sender/from of emails based on reply-to header.' ,
2018-12-19 17:31:51 +00:00
options : { } ,
state : 'Channel::Filter::ReplyToBasedSender' ,
frontend : false
2017-05-26 13:34:32 +00:00
)
end
end