title: Adding action to Contact Form 7 submit w/ PHP hook
body: <p>I'm having some trouble implementing a bit of custom functionality in the Contact Form 7 plugin for Wordpress.</p>
  
  <p>What I want to do is pretty straightforward.  The contact form in question is a normal contact inquiry form, so I need to retain the usual functionality (mailing the data).  However I also have a checkbox on the form that allows the sender to choose whether to subscribe to the client's mailing list in addition to mailing the contact inquiry.</p>
  
  <p>The client uses Bronto for their mass mailing (similar to CC or Mailchimp).  Bronto has a "direct add" feature (<a href="http://community.bronto.com/blog/how-to/adding-contacts-direct-add" rel="nofollow">more info here</a>) that allows you to send parameters to add contacts to the Bronto account by embedding an image whose url contains the requisite parameters (email address, list to subscribe to, etc).</p>
  
  <p>I can construct the image url with the contact form parameters no problem, but actually getting the image request sent is a different matter.  I am over my head both in PHP and JS here and not sure what course to take.</p>
  
  <p>Currently I'm using the <code>wpcf7_before_send_mail</code> php hook built into CF7 and this appears to allow me to collect the form data and build the URL.  However, since the plugin uses AJAX and doesn't actually redirect to another page on form submission it seems I can't successfully use any kind of php output (echo, alert, even error_log), presumably because the server doesn't know what it's supposed to write to.</p>
  
  <p>In functions.php:</p>
  
  <pre><code>add_action( 'wpcf7_before_send_mail', 'bronto_contact_add' );
  function bronto_contact_add( $cf7 ) {
      $emailcf = $cf7-&gt;posted_data['email'];
      echo $emailcf;
  }
  </code></pre>
  
  <p>This is just a test to see if echo works - it does not.  Instead the form just hangs on submission and I see the rotating loading gif forever.</p>
  
  <p>What I need to do is build the image url using parameters from the cf7 object (which I can do no problem) and then somehow send that image request to the Bronto server (this is the part I am confused about).  If this was a normal form that redirected to another php page upon submission I would have no problem doing this at all, but it uses AJAX which I don't know much about so I'm pretty lost now.</p>
  
  <p>Can anybody help shed some light on how the best way to accomplish this might be?</p>