WordPress.org

Forums

Fast Secure Contact Form
"send to:" email from post (9 posts)

  1. Energias
    Member
    Posted 4 years ago #

    I have many posts with different companies information. I would like to create a custom field for the company email and then at the end of the post I would like to have that email inserted in the contact form to be the "send to:" email.

    Is it possible?

  2. Mike Challis
    Member
    Plugin Author

    Posted 4 years ago #

    Maybe with a special modification. It is best not to reveal users' email address, so a query string URL is not a good idea.

    I could add a email_to capability to the shortcode. Would you be able to code something to dynamically change the shortcode in your page?
    Something like this?

    [si-contact-form form='1' email_to='<?php echo $email_to; ?>']

    Or in a template with PHP:

    <?php
    if ( isset($si_contact_form) )  {
     echo $si_contact_form->si_contact_form_short_code( array(
    'form' => '1',
    'email_to' => "$email_to",
    
    ) );
    }
    ?>

    Mike

  3. Energias
    Member
    Posted 4 years ago #

    Many thanks Mike

    If you could add a email_to capability to the shortcode that is nice.

    I ad the code to the template:

    <?php
    if ( isset($si_contact_form) )  {
     echo $si_contact_form->si_contact_form_short_code( array(
    'form' => '1',
    'email_to' => "$email_to",
    
    ) );
    }
    ?>

    Thanks

  4. Mike Challis
    Member
    Plugin Author

    Posted 4 years ago #

    The new code is tested and uploaded.

    You will have to update the program:
    http://www.fastsecurecontactform.com/update-to-the-latest

    See this FAQ
    Tip: setting optional form parameters with shortcode
    http://www.fastsecurecontactform.com/shortcode-options

    Setting optional email_to with shortcode:
    Each contact has a name and an email address separated by a comma.
    Webmaster,user1@example.com (must use this format: name,email)
    Also, you can have multiple E-mails, this is called a CC(Carbon Copy). Separate each CC with a semicolon.
    Webmaster,user1@example.com;user2@example.com (must use this format: name,email;email;email)
    Note: this will override any email_to that is set in the form settings!

    Examples:

    [si-contact-form form='1' email_to='Webmaster,user1@example.com']
    [si-contact-form form='1' email_to='Webmaster,user1@example.com;user2@example.com']
    <?php
    if ( isset($si_contact_form) )  {
     echo $si_contact_form->si_contact_form_short_code( array(
    'form' => '1',
    'email_to' => "$name,$email_to",
    
    ) );
    }
    ?>

    If you do not have name, set something anyway, like this:
    'email_to' => "user,$email_to",

  5. Energias
    Member
    Posted 4 years ago #

    Thanks Mike

    I will try it

  6. Energias
    Member
    Posted 4 years ago #

    I placed

    <?php
    if ( isset($si_contact_form) )  {
     echo $si_contact_form->si_contact_form_short_code( array(
    'form' => '2',
    'email_to' => "user,$email_to",
    
    ) );
    }
    ?>

    inside my template on file single.php

    it shows the post and the contact form at the end, but when I send an email through contact form, the custon field with the email that I create inside the post doesn't receive an email.

    My custom field is mail_to user@company.com

    Am I doing something wrong?

  7. Mike Challis
    Member
    Plugin Author

    Posted 4 years ago #

    For a test, echo the $email_to on the page to make sure it has the email variable
    <?php echo 'Email to:'.$email_to ?>

    Mike

  8. Energias
    Member
    Posted 4 years ago #

    Yes, it shows "Email to:"

  9. Mike Challis
    Member
    Plugin Author

    Posted 4 years ago #

    Then it is not picking up the email address you are trying to populate it with.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Fast Secure Contact Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic