Contact Form 7 – doing *something* when an email has been sent
I love contact form 7, unlike a fair few others who have either purchased Gravity forms or who have gotten stuck using something like CForms which I really don’t get along with. I use it on every site I write and, with the new addition of the Flamingo plugin which, despite it’s infancy, has potential for the future, rarely find anything I can’t do with it. In this case I needed to perform a web service call when an email had been sent but couldn’t find an obvious way of doing so. So I dug into the code and found a way to do it which I thought I would share.
There is a handy action hook which does just what I needed called ‘wpcf7_mail_sent’ which I wrote a couple of lines for and it worked a treat. Hopefully someone else can find another use for this to save them getting into the code..
The code
add_action('wpcf7_mail_sent', 'hm_pixel_conversion'); function hm_pixel_conversion( &$args ) { //Web service call goes here }
0 Comments