Support » Plugin: Fast Secure Contact Form » [Plugin: Fast Secure Contact Form] "send to:" email from post

  • Energias

    (@energias)


    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)
  • Plugin Author Mike Challis

    (@mikechallis)

    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

    Energias

    (@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

    Plugin Author Mike Challis

    (@mikechallis)

    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",

    Energias

    (@energias)

    Thanks Mike

    I will try it

    Energias

    (@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 user@company.com

    Am I doing something wrong?

    Plugin Author Mike Challis

    (@mikechallis)

    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

    Energias

    (@energias)

    Yes, it shows “Email to:”

    Plugin Author Mike Challis

    (@mikechallis)

    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.