HCG Web Services Documentation
25 Jan 2016 • Version 2.0

Remote Tags for MailForm

These remote tags are designed to provide Contact Us web form fuctionality through a simple tag placed in a remote website.

NOTE: Remote Tags are a restricted service and are intended for use only in websites owned by The Hain Celestial Group. They are not for general use. Please contact Jim Applegate if you need to set up access to Remote Tags.

Base URL : http://rtags.hcgweb.net/{version}/mailform/

The current version is v2.

The HTTP Method used is POST.

Available Tags:

contactUsStart

Displays a shortened Contact Us form. When the form is submitted, it sends the data to the larger contactUs form. This is intended for use in circumstances where starting a contact us submission is just one option on a page. If you are creating a simple Contact Us form, use the contactUs tag.

The data must be submitted via the POST method.

URL Format

http://rtags.hcgweb.net/{version}/mailform/contactUsStart

Parameter Required Description Options and Samples
version Yes The version of the rTag that you are using. Indicated as part of the URL. v1
form-tpl No The template name for the contact us form.* contact-us
Default: contact-us
action No The URL for the page where the form will be processed. This must be a page containing the contactUs remote tag. It will not work for the action to point to the same page containing the contactUsStart tag. http://example.com/contact-us
Default: /contact-us

*For security reasons, there is no mechanism for overriding templates directly from a remote server. Many modifications can be made using CSS, but if you need to make markup changes to a template, contact Jim Applegate to either modify the default template or add a new template to the list of options.

Example Pages

The example page below shows what the tag looks like in action.

Templates and CSS

The code

The code below shows how to place the remote tag into your website page using cURL and PHP. Other implementations are possible.

<?php
   $post_array = array();
   $post_vars = '';
   $ch = '';
   $output = '';
   $rtag_url = 'http://rtags.hcgweb.net/v2/mailform/contactUsStart';
   
   $config = array();
   $config['site-id'] = 'hcgweb';
   $config['form-tpl'] = 'contact-us';
   $config['action'] = 'contact-us-example-2.html';
   
   foreach ($config AS $key => $value)
      $post_array[] = $key.'='.$value;
   
   foreach ($_POST AS $key => $value)
      $post_array[] = $key.'='.$value;

   $post_vars = implode('&', $post_array);

   $ch = curl_init($rtag_url);
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars);
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $output = curl_exec($ch);
   curl_close($ch);
        
   echo $output;
?>

contactUs

Displays the full Contact Us form. When the form is submitted, a Thank You page is displayed and all emails are sent out.

The data must be submitted via the POST method.

URL Format

http://rtags.hcgweb.net/{version}/mailform/contactUs

Parameter Required Description Options and Samples
version Yes The version of the rTag that you are using. v1
site-id Yes The alpha code used to identify on which HCG site the tag is used. ge = Garden of Eatin'

See a complete list of codes.
form-tpl No The template name for the contact us form.* contact-us
Default: contact-us
mail-tpl No The template name for the email sent to consumer relations for internal processing.* contactus-mail.tpl
http://example.com/templates/contactus-mail.tpl
Default: contactus-mail.tpl
reply-tpl No The template name for the auto-reply email sent to the consumer.* contactus-reply.tpl
http://example.com/templates/contactus-reply.tpl
Default: contactus-reply.tpl
safe-tpl No The template name for the email sent to other interested parties, internal or otherwise. It is called safe because the FROM: is set to do-not-reply@hain-celestial.com so that the consumer will not receive out-of-office notifications.* contactus-safe.tpl
http://example.com/templates/contactus-safe.tpl
Default: contactus-safe.tpl
action No The URL for the page where the form will be processed. Set this if you want to have the results display on a different page than the one displaying the form. $_SERVER['PHP_SELF'];
http://example.com/my-results-page
Default: #
marketing No Toggle for whether to display the "additional information" checkbox below the form. TRUE
TRUE
Default: TRUE
privacy No The URL for the site's privacy policy page. If there is no privacy policy, you can supply an empty string (''), and the statement about the policy will be omitted. http://www.hain-celestial.com/about_us/policies.php
Default: /privacy.php
release No Toggle for whether to display the "use this comment" checkbox below the form. TRUE
TRUE
Default: TRUE
redirect No The page that we should go to if we suspect that the user is a robot or accessing the form illegally. http://example.com/consumer-info
Default: consumer-info
thank-you No The page that we should go to to thank the user. There is a default thank you that will display if this is left blank, but this allows you to create a special message if desired. http://example.com/thank-you
Default: #

*If you need changes made to any of the default templates, contact Jim Applegate to either modify the default template or add a new template to the list of options. In most cases, the default email templates will work just fine.

Example Pages

The example page below shows what the tag looks like in action.

Templates and CSS

You can download some of the default templates to override them on your site:

Template variables

All three mail templates have the same variables available to them as listed below.

Variable Description
{FName} The submitter's first name
{LName} The submitter's last name
{Address1} The first line of the submitter's address
{Address1} The first line of the submitter's address
{City} The submitter's city
{State} The submitter's state
{Country} The submitter's country
{Zip} The submitter's zip or postal code
{Phone} The submitter's daytime phone number
{Email} The submitter's email address
{Comment} The comment or message submitted
{Marketing} Whether the submitter opted-in to recieve additional information about the brand (YES or NO)
{Release} Whether the submitter released their comment to be used on the website (YES or NO)
{brand_name} The brand name based on the site ID. For example, if the site ID is ge, the brand name will be Garden of Eatin'
{DateSent} The date the message was sent in the form YYYY-MM-DD.
{URL} The URL to which the form was submitted. This is included as a way to identify from which site the submission came.

The code

The code below shows how to place the remote tag into your website page using cURL and PHP. Other implementations are possible.

<?php
   $post_array = array();
   $post_vars = '';
   $ch = '';
   $output = '';
   $rtag_url = 'http://rtags.hcgweb.net/v2/mailform/contactUs';
   
   $config = array();
   $config['site-id'] = 'hcgweb';
   $config['form-tpl'] = 'contact-us';
   $config['mail-tpl'] = 'contactus-mail.tpl';
   $config['reply-tpl'] = 'contactus-reply.tpl';
   $config['safe-tpl'] = 'contactus-safe.tpl';
   $config['action'] = $_SERVER['PHP_SELF'];
   
   foreach ($config AS $key => $value)
      $post_array[] = $key.'='.$value;
   
   foreach ($_POST AS $key => $value)
      $post_array[] = $key.'='.$value;

   $post_vars = implode('&', $post_array);

   $ch = curl_init($rtag_url);
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars);
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $output = curl_exec($ch);
   curl_close($ch);
        
   echo $output;
?>