User Tools

Site Tools


en:public:developer:template_system:tags:api:contact_us

<#contact_us>

Use this function to send a contact request via email. This function will be typically called from cfgpages.

Parameters

Parameters taken from the tag

Name Mandatory Description
Privatekey Yes The ReCaptcha private key
Template Yes The mail template

Parameters taken from HTTP GET/Post data

Name Mandatory Description
Recaptcha_challenge Yes The value of “recaptcha_challenge_field” sent via the form
Recaptcha_response Yes The value of “recaptcha_response_field” sent via the form
email Yes the sender email
company No the sender company name
name No the sender name
first_name No the sender first name
product No the product
subject No the subject of the email

Error Codes

Code Description
122 Wrong Captcha

Example

Exemple of the template :

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  </head>
  <body>
    <#if condition="<#name checksum=1>"><b>Name:</b> <#name xmlencode=1><br /><#endif>
    <#if condition="<#first_name checksum=1>"><b>First name:</b> <#first_name xmlencode=1><br /><#endif>
    <#if condition="<#company checksum=1>"><b>Company:</b> <#company xmlencode=1><br /><#endif>
    <#if condition="<#email checksum=1>"><b>Email:</b> <#email xmlencode=1><br /><#endif>
    <#if condition="<#phone1 checksum=1>"><b>Phone:</b> <#phone1 xmlencode=1><br /><#endif>
    <#if condition="<#product checksum=1>"><b>Product:</b> <#product xmlencode=1><br /><#endif>
    <#if condition="<#message checksum=1>"><br /><#message xmlencode=1><#endif>
  </body>
</html>

Exemple of cfgpages configuration node

<page name="share_url_by_email">
  <cfg>
    <frames>
      <frame name="content" 
             processname="contact_us" 
             privatekey="...." 
             template="emails\contact_us.&lt;#language&gt;.html"/>
    </frames>
    <maintemplate>maintemplates\maintemplate_empty.html</maintemplate>
    <content_type>&lt;#content_type&gt;</content_type>
  </cfg>
</page>

Exemple of API call

  ak_call_api("/api/contact_us/",  /* the api url */
              {
               Email: "me@exemple.com",
               Name: "My Name",
               Message: "my message",
               Recaptcha_challenge: Recaptcha.get_challenge(), 
               Recaptcha_response: Recaptcha.get_response()
              }, /* the post params */
              ...
              );
en/public/developer/template_system/tags/api/contact_us.txt · Last modified: 2013/06/07 15:55 by svanderclock