Author Topic: Customizing sending an email for contribution  (Read 170 times)

Offline xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3790
  • Karma: 136
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Customizing sending an email for contribution
« on: June 08, 2012, 01:51:55 am »
Hi,

I need to send a receipt when a contribution has been paid (either when the payment provider confirmed the payment, or when receiving the check).

This is for tax reduction purpose, in France you can deduce 2/3 of the amount you give to a registered NGO (lots of rules and limits, but  that's the idea). the NGO has to send to the contributors that request it a specific pdf mentioning the amount and so on.

We have implemented it using the pdf letter templating system and some custom token, but not sure what's the best way to send it.

What would you suggest?

I'm thinking of using the send confirmation feature ( CRM/Core/BAO/MessageTemplates.php ) but I don't see any hook to alter the way the pdf is generated.  Would it make sense to add one?

The other hook I can think of is on the alterMailParams, but it doesn't seem that the param contains the "type" of email, eg. so that's easy to see if it's a contribution receipt, civimail...

Any suggestion on how to do it?

Also, is there a suggestion on how to test the payment provider callback? I'd want to generate a unique receipt id (following a different number schema than the contrib id) there, but so far I didn't manage to catch it on a post hook.

Is there a clever way of testing/debugging that part?

X+