2

I want to call a function whenever a CiviMail is sent from our system, to send a log message to a third party system (Slack in this case).

I've had a look at the CiviCRM documentation, and while I can see hooks for both before/after an email is sent, I can't see one for a CiviMailing. I could in theory use these hooks, but even if I de-duplicated it down to a single record, it wouldn't contain information about the mailing (such as mailing name, mailing size, groups, etc).

What's the best option to accomplish this? Is there a relevant hook? Would I need to run a cronjob to check the relevant tables?

1

to be checked, but creating a mailing should go through the normal hooks like the other entities in civi

so if you go with the pre or post hooks http://wiki.civicrm.org/confluence/display/CRMDOC/Database+hooks

hook_civicrm_post( $op, $objectName, $objectId, &$objectRef )   

you should have one with the objectname mailing you want to handle and do the needed

  • Aha, generic hooks! I'll give it a try and report back. – Effy Elden Jul 1 '15 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.