Support » Plugin: Contact Form 7 Dynamic Text Extension » Help with setting CF7 Mail “To” field from custom field?

  • Hope someone can give me a bit of help! I am following the instructions here: http://sevenspark.com/wordpress-plugins/how-to-dynamically-set-the-recipient-to-email-address-in-contact-form-7

    1. I created a custom field named user_email. Custom field type is email, and is required.

    2. I created a CF7 form, placed a dynamic hidden field with this shortcode: [dynamichidden recipient-email “CF7_get_custom_field key=’user_email'”]

    3. I created a page, placed the form shortcode and entered a value in the user_email field.

    4. Placing [recipient-email] in the message body of the mail panel puts the custom field data into the email. All good.

    5. Instructions say: Copy the name tag [recipient-email] into the To: input. BUT placing [recipient-email] in the To field of the mail panel gives a configuration error: Invalid mailbox syntax is used. Form is broken.

    So I’m confused. How should this be done?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Petr

    (@csclubtauranga)

    Same problem here. CF7 help suggest that the value going to “TO:” field should be “required”, so there is always a recipient to the email. But the dynamichidden doesn’t work with “*” (required mark) and the shortcode renders as plain text on the front end. Notwithstanding, the email validation still highlights the key as incorrect.

    I have found another (non-working method) 🙂 It would appear that CF7 can pickup value from custom fields without another plugin, as see for details. And whilst I can see the value being pulled into the front end, the form complains and email will not send.

    Have you been able to resolve it?

    Petr

    (@csclubtauranga)

    Okay, I have managed to find an acceptable solution. It revolves around the ability to pull info from custom meta (and other fields) on the page. CF7 details the method in Getting Default Values from Shortcode Attributes post.

    Slight downside is the fact that you need to use email* type for the key value. Otherwise the validation process is going to complain. Also, the field cannot be hidden from the front end, so we have to use css to stop it from displaying. The downside is that it is still the page code and available for scrapers to harvest it. Perhaps some obfuscating techniques could hide it altogether from bots.

    Hi,

    getting the same issue here with [recipient-email]

    about the obsfucate:
    he gives an advise to use:
    [dynamichidden recipient-email "CF7_get_custom_field key='user_email' obfuscate='on'"]

    you can read it further by his page:
    http://sevenspark.com/wordpress-plugins/how-to-dynamically-set-the-recipient-to-email-address-in-contact-form-7

    Cheers

    Petr

    (@csclubtauranga)

    I’m just dealing with an issue I can’t fathom. The solution worked, as described above, without a hitch for a few days. Now something has changed (probably) and I can’t get the value through.

    I have further plugged in the shortcode inside a custom post and was getting the email from the page.

    Now when I try I get blank input field. Perhaps someone can see, what’s going wrong

    $artist_email =  gdlr_get_portfolio_info(array('artist-email'), $gdlr_post_option, false);
    echo do_shortcode( '[contact-form-7 id="16" title="Artist Booking Form - do not delete" artist-email=" '. $artist_email .' "]' );

    When I simply echo the variable $artist_email I can see it no problem. I can even see the first character if I do:
    echo do_shortcode( '[contact-form-7 id="16" title="Artist Booking Form - do not delete" artist-email=" '. $artist_email[0] .' "]' );

    But not the complete address. What gives?

    Sorry, I don’t have a proper answer for you but I did find a workaround:

    I created a custom field called rsvp_email and inserted that into my post

    I put [dynamichidden rsvp_email “CF7_get_custom_field key=’user_email'”] into the form and Bcc: [rsvp_email] into the mail panel under Additional Headers

    So the form sends to the specified email address as a blind cc. Not pretty, but it works.

    Petr

    (@csclubtauranga)

    @pedro-magnifico It that way, do you use a “throw-away” email in the To field? Without an email value in the To: my form will not validate.

    Yes, exactly. noreply@example.com, for instance.

    It will show the bcc as a configuration error but it will work.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Help with setting CF7 Mail “To” field from custom field?’ is closed to new replies.