Clarity

 View Only
  • 1.  Gel and HTML

    Posted Dec 07, 2023 08:30 AM

    Hi All,

    I am trying to send an email of HTML Fomat.

    Is it possible to save the link as a variable and use it in href.

    So something like

    <a href=variable_link>variable_name</a>

    Where variable_link and variable_name are both variables.

    Regards



  • 2.  RE: Gel and HTML

    Posted Dec 11, 2023 12:36 PM
    Edited by Gustavo de Almeida / DATAPREV Dec 11, 2023 12:36 PM

    Hello,
    Yes, it is possible. 

    You can use the example below:

    <gel:script xmlns:core="jelly:core" xmlns:file="jelly:com.niku.union.gel.FileTagLibrary" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
      xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sql="jelly:sql"
      xmlns:xog="http://www.niku.com/xog" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    
      <core:catch var="error">
    
        <gel:parameter var="v_FROM_ADDRESS" default="sender@email"/>
        <gel:parameter var="v_TO_ADDRESS" default="receiver@email"/>
        <gel:parameter var="v_VARIABLE_LINK" default="https://google.com"/>
        <gel:parameter var="v_VARIABLE_NAME" default="Click me, I am a variable link!"/>
        <gel:parameter var="v_SUBJECT" default="HTML Email with Variables"/>
    
        <gel:email from="${v_FROM_ADDRESS}" subject="Testing - ${v_SUBJECT}" to="${v_TO_ADDRESS}">
          <![CDATA[
            <html>
              <head/>
              <body>
                <br/><br/>
                <p>
                  <h2>Testing HTML Email with Variables.</h2>
                  <a href="${v_VARIABLE_LINK}">${v_VARIABLE_NAME}</a>
                </p>
              </body>
            </html>]]>
        </gel:email>
           
      </core:catch>
    </gel:script>

    -----------------

    This will result in the following email: