Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8423

hook_civicrm_alterMailParams improvements

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4
    • Fix Version/s: 3.4.5, 4.0.5
    • Component/s: CiviMail, Core CiviCRM
    • Labels:
      None

      Description

      the attached patches add some important improvements to the alterMailParams hook

      1) right now we call this hook within civimail and also when activity-based emails are sent, but there is no way to distinguish the context from within the hook. so we add a $source param (maybe change to $context?) set to "activity" by default, but set to "civimail" when called within the civimail compose method. that way we can selectively choose when to implement modifications.

      2) when called within civimail, the hook does not do what you expect in all instances. specifically, there are some header values passed to the hook but which the hook cannot modify – as the values are not passed back to the message object. for example – the hook params array includes the reply-to key, but altering it does nothing because the header is not updated after the hook is called. also – you can't currently use this hook to add custom headers to the mailing (we are using a 3rd party smtp service which we can pass some values to for reporting purposes).

      so this patch takes what was returned by alterMailParams and seeds the header array so that all values are preserved/modified as expected.

        Attachments

        1. CRM_Mailing_BAO_Mailing.php.patch
          1 kB
          Brian Shaughnessy
        2. CRM_Utils_Hook.php.patch
          1 kB
          Brian Shaughnessy

          Activity

            People

            • Assignee:
              rajan Rajan P Mayekar
              Reporter:
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: