• 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?

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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

    Thread Starter RuyR

    (@energias)

    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

    The new code is tested and uploaded.

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

    See this FAQ
    Tip: setting optional form parameters with shortcode
    https://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,[email protected] (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,[email protected];[email protected] (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,[email protected]']
    [si-contact-form form='1' email_to='Webmaster,[email protected];[email protected]']
    <?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",

    Thread Starter RuyR

    (@energias)

    Thanks Mike

    I will try it

    Thread Starter RuyR

    (@energias)

    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 [email protected]

    Am I doing something wrong?

    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

    Thread Starter RuyR

    (@energias)

    Yes, it shows “Email to:”

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Fast Secure Contact Form] "send to:" email from post’ is closed to new replies.