CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • hook_alterMailParams
Pages: [1]

Author Topic: hook_alterMailParams  (Read 1157 times)

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
hook_alterMailParams
November 16, 2010, 09:19:04 am
Hi guys,

3 quick questions about this hook.

1. Does it fire on bulk mailing via civimail?
2. Does it fire after replacement token values have been merged?
3. I think it would be great if we can also alter the mail headers in the $param


Thanks,


Cheers!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: hook_alterMailParams
November 16, 2010, 09:37:15 am
For the two questions: not sure, try to check when/why.

As for the header, what would you like to add/alter ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: hook_alterMailParams
November 16, 2010, 02:40:13 pm
Just checked

1. Yes it works with bulk mailing
2. Slight problem there, I'm trying to auto append google analytics tracking code to the emails messages they are appended after civimail has rewrote al the links (if clickthrough tracking is enabled), which means that the hook fires after the link rewrite, (my suggestion is that it should fire before, or have the link rewriter not drop the additionally appended query strings)
3. We use X-xsMailingId (which corresponds to the civi mail Mailing ID) to track and sync our mailings from the SMTP server to Civi, right now we do a small core hack in the BAO/Mailing.php to add that header but it could be useful.


Cheers!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: hook_alterMailParams
November 16, 2010, 06:43:02 pm

2. wanna fix the code so the link rewriter does not drop the additional strings. This hook is called late in the process, so a lot harder to call it before token substitution

3. We should upgrade the hook to send in both the contents and also the headers, so folks can add (or remove) headers. Ping me on iRC later this week and we can work on a patch for 3.3 :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: hook_alterMailParams
November 16, 2010, 10:01:30 pm
Quote from: xcf33 on November 16, 2010, 02:40:13 pm

2. Slight problem there, I'm trying to auto append google analytics tracking code to the emails messages they are appended after civimail has rewrote al the links (if clickthrough tracking is enabled), which means that the hook fires after the link rewrite, (my suggestion is that it should fire before, or have the link rewriter not drop the additionally appended query strings)

nice idea! Are you going to make it a separate module so other can plug it in ?

Quote from: xcf33 on November 16, 2010, 02:40:13 pm


3. We use X-xsMailingId (which corresponds to the civi mail Mailing ID) to track and sync our mailings from the SMTP server to Civi, right now we do a small core hack in the BAO/Mailing.php to add that header but it could be useful.



FYI, we have (as of 3.2.x) already a X header (containing basically the info in the mail envelope, ie mailing or job id and contact I think). Might be something you can use or does it need to bin X-xsMailingId ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: hook_alterMailParams
November 17, 2010, 11:50:42 am
1. It's going to be a module that appends source code information by using drupal hooks, so yes it can be plugged in :)

2. The  X-xsMailingId is something that our SMTP provider use to identify each bulk mailing, it enables us to use their API to sync a lot of mailing information with Civi

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • hook_alterMailParams

This forum was archived on 2017-11-26.