20170525000001_reply_to_sender_feature.rb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. class ReplyToSenderFeature < ActiveRecord::Migration[4.2]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. Setting.create_if_not_exists(
  6. title: 'Sender based on Reply-To header',
  7. name: 'postmaster_sender_based_on_reply_to',
  8. area: 'Email::Base',
  9. 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.',
  10. options: {
  11. form: [
  12. {
  13. display: '',
  14. null: true,
  15. name: 'postmaster_sender_based_on_reply_to',
  16. tag: 'select',
  17. options: {
  18. '' => '-',
  19. 'as_sender_of_email' => 'Take reply-to header as sender/from of email.',
  20. 'as_sender_of_email_use_from_realname' => 'Take reply-to header as sender/from of email and use realname of origin from.',
  21. },
  22. },
  23. ],
  24. },
  25. state: '',
  26. preferences: {
  27. permission: ['admin.channel_email'],
  28. },
  29. frontend: false
  30. )
  31. Setting.create_if_not_exists(
  32. title: 'Defines postmaster filter.',
  33. name: '0011_postmaster_sender_based_on_reply_to',
  34. area: 'Postmaster::PreFilter',
  35. description: 'Defines postmaster filter to set the sender/from of emails based on reply-to header.',
  36. options: {},
  37. state: 'Channel::Filter::ReplyToBasedSender',
  38. frontend: false
  39. )
  40. end
  41. end