How to CC/BCC in Mass E-Mail?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tobias
    Senior Member
    • May 2016
    • 229

    How to CC/BCC in Mass E-Mail?

    We'd like cc recipients in mass e-mails:
    a@b.com, c@d.com etc. are part of the target list selected for the campaign.

    How can we achieve this?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    Only developing it

    Comment

    • tobias
      Senior Member
      • May 2016
      • 229

      #3
      Since we only need this for a couple of mailings: Any hint where we could place a quick hack in your code?

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        application/Espo/Modules/Crm/Services/MassEmail.php
        processSending or sendQueueItem(!) method

        Comment

        • tobias
          Senior Member
          • May 2016
          • 229

          #5
          Thanks Tanya,

          We've added the following code:

          Code:
          vi crm/application/Espo/Modules/Crm/Services/MassEmail.php
          
                  /*  Add CC */
                  if($massEmail->get('ccAddress')) {
                      $email->set('cc', $massEmail->get('ccAddress'));
                  }
          
          vi crm/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json
          
                  "ccAddress": {
                      "type": "varchar",
                      "trim": true
                  },
                  "ccName": {
                      "type": "varchar"
                  },
          Although cc_address and cc_name were successfully added as fields to DB table mass_email after rebuild, these fields would not show up in #MassEmail/view/

          Any idea what else we need to change?
          Last edited by tobias; 09-21-2017, 12:26 PM.

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            the easiest way is to copy application/Espo/Modules/Crm/Resources/layouts/MassEmail/detail.json to custom/Espo/Custom/Resources/layouts/MassEmail/detail.json and add needed field manually. Clear Cache

            Comment

            • tobias
              Senior Member
              • May 2016
              • 229

              #7
              Works a treat, thanks so much!

              These are our final modifications:

              Code:
              vi crm/application/Espo/Modules/Crm/Services/MassEmail.php
              
                  function getPreparedEmail:
              
                      /*  Add CC */
                      if($massEmail->get('ccAddress')) {
                          $email->set('cc', $massEmail->get('ccAddress'));
                      }
              
                  function sendQueueItem:
              
                      /* Add CC */
                      if ($massEmail->get('ccName')) {
                          $params['ccName'] = $massEmail->get('ccName');
                      }
              
              
              vi crm/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json
              
                      "ccAddress": {
                          "type": "varchar",
                          "trim": true
                      },
                      "ccName": {
                          "type": "varchar"
                      },
              
              mkdir crm/custom/Espo/Custom/Resources/layouts/MassEmail
              cp crm/application/Espo/Modules/Crm/Resources/layouts/MassEmail/detail.json crm/custom/Espo/Custom/Resources/layouts/MassEmail/detail.json
              vi crm/custom/Espo/Custom/Resources/layouts/MassEmail/detail.json
              
                      [
                          {"name": "ccAddress"},
                          {"name": "ccName"}
                      ]
              There's still an issue with adding ccName, which is somehow ignored by Zend Mail. But that's it.

              Comment

              Working...