title: Dynamic email in CF7 (using custom fields)
body: <p>I'm trying to dynamically update the CF7 to field by replacing the recipient string with a custom post field value, though I can't figure out how to assign the value it's definitely replacing the string as I get an error and if I change email it sends. So it tells me the problem is when I'm trying to get the value.</p>
  
  <pre><code>&lt;?php
  function wpcf7_dynamic_email_field($args) {
    $dynamic_email = get_post_meta(get_the_ID(), 'dynamic_email', true);
    if(!empty($args['recipient'])) {
      $args['recipient'] = str_replace('emailtobereplaced@email.com', $dynamic_email["dynamic_email"], $args['recipient']);
      return $args;
    }
    return false;
  }
  add_filter('wpcf7_mail_components', 'wpcf7_dynamic_email_field');
  ?&gt;
  </code></pre>
  
  <p>Can anyone point me in the right direction here? My custom field is called dynamic_email and I need the value</p>