User Tools

Site Tools


en:public:developer:template_system:tags:api:share_url_by_email

<#share_url_by_email>

Use this function to send an url link 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
Url No The url to share. If empty the current url will be taken
From Yes the sender email
To Yes the recipient 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="<#AMRequest.values['Url'] checksum=1>">
      <a href="<#AMRequest.values['Url']>"><#AMRequest.values['Url']></a><br />
    <#else>
      <a href="<#Url>"><#Url></a><br />
    <#endif>
 
    <#if condition="<#AMRequest.values['message'] checksum=1>">
      <br />
      <#AMRequest.values['message']><br />
    <#endif>
 
    <br />
    <br />
 
    Message sent via <#url id=/>     
  </body>
</html>

Exemple of cfgpages configuration node

<page name="share_url_by_email">
  <cfg>
    <frames>
      <frame name="content" 
             processname="share_url_by_email" 
             privatekey="...." 
             template="emails\email_share_url_by_email.&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/share_url_by_email/",  /* the api url */
              {
               From: "me@exemple.com",
               To: "you@exemple.com",
               Message: "my message",
               Recaptcha_challenge: Recaptcha.get_challenge(), 
               Recaptcha_response: Recaptcha.get_response()
              }, /* the post params */
              ...
              );
en/public/developer/template_system/tags/api/share_url_by_email.txt · Last modified: 2013/04/23 10:12 by svanderclock