wiki:ClientsPlugin/Actions/SendEmail

Send Email: ClientsPlugin Event Action

Description

The Send Email action will, unsurprisingly, send an email to a client when the event is triggered. In order to format the XML Summary into an email it uses XSLT to transform it accordingly.

The transform will actually be called several times, with different arguments to allow a MIME email encapsulating HTML, text and images to be created.

Example XSLT

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  
  <xsl:output method="html" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>
  <xsl:decimal-format name="GBP" decimal-separator="." grouping-separator=","/>
  
  <!-- Match the root of the XML render the three views -->
  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="$view='html'">
        <!-- Should return HTML as you see fit -->
        <xsl:call-template name="html"/>
      </xsl:when>
      <xsl:when test="$view='images'">
        <!--
        Should return a list of images to embed in the following format:
        
        <images>
          <img id="myimage" src="/local/path/to/image"/>
        </images>
        
        Where "myimage" is references in your HTML image as <img src="cid:myimage" />
        -->
        <xsl:call-template name="images"/>
      </xsl:when>
      <xsl:otherwise>
        <!-- The plain text portion of the email -->
        <xsl:call-template name="plain"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <!-- Simple (cop-out) implementation of a plain text message -->
  <xsl:template name="plain">
    <xsl:text>
This message contains HTML content for a rich display.

Please enable the HTML view or use an HTML compatible email client.
    </xsl:text>
  </xsl:template>
  
  <!-- This HTML version does not contain any images -->
  <xsl:template name="images"/>
  
  <xsl:template name="html">
    <!-- The root element needs to be created with xsl:element to prevent namespaces sneaking in. -->
    <xsl:element name="html">
      <head>
        <title>Ticket Summary for <xsl:value-of select="/clientsplugin/client/name"/></title>
     </head>
      <body>
        <h1>Ticket Summary for <xsl:value-of select="/clientsplugin/client/name"/></h1>
        <!-- actually do something clever with the input XML.... -->
      </body>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>

How to download video from vimeo

Last modified 3 years ago Last modified on Oct 27, 2011, 11:19:52 AM