Contact Form 7 – doing *something* when an email has been sent

April 16, 2014 | Time Savers, Troubleshooting, Wordpress | 0 comments

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

A Donate Button!


Leave a Reply

Divi United

About this site and Sean Barton

Picture of Sean
Sean Barton is a Freelance PHP Website Developer in Crewe, Cheshire. He is a Wordpress and CMS/Framework specialist.
This site was set up in 2008 as a tutorial and scripting resource for the PHP language and Wordpress.
Find out more about Sean on the About Me page or use the Hire Me page to get in touch. For more information about Sean's work take a look at the Portfolio

Our Services

  • Wordpress plugin/theme development
  • Divi specialist
  • Ecommerce (Woocommerce, WPSC, Shopify, Magento)
  • PSD to Wordpress theme conversion (Responsive)
  • Website design work (Banners, Logos, Full Site, etc)
  • Website analysis (security, usability, SEO)
  • API Integrations (InfusionSoft, SalesForce, Ontraport, Customer Thermometer, etc..)
  • Wordpress consultancy & expert advice
  • Crisis support
  • Website hosting

The main services offered are Wordpress based although we do a great deal of technical programming for bespoke systems. From troubleshooting, extending frameworks, finding bugs to writing them from scratch.

Find out more by looking through our past projects or get a quote.

Be the first to hear about new products/updates!

This is a mailing list for those people interested in being told when we release a new product (Divi plugin or Theme).

We shall also use this list to let you know about product updates and releases.

You have Successfully Subscribed!