Version 1 (modified by Colin Guthrie, 12 years ago) (diff)


Send Email: ClientsPlugin Event Action


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: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:when test="$view='html'">
        <!-- Should return HTML as you see fit -->
        <xsl:call-template name="html"/>
      <xsl:when test="$view='images'">
        Should return a list of images to embed in the following format:
          <img id="myimage" src="/local/path/to/image"/>
        Where "myimage" is references in your HTML image as <img src="cid:myimage" />
        <xsl:call-template name="images"/>
        <!-- The plain text portion of the email -->
        <xsl:call-template name="plain"/>
  <!-- Simple (cop-out) implementation of a plain text message -->
  <xsl:template name="plain">
This message contains HTML content for a rich display.

Please enable the HTML view or use an HTML compatible email client.
  <!-- 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">
        <title>Ticket Summary for <xsl:value-of select="/clientsplugin/client/name"/></title>
        <h1>Ticket Summary for <xsl:value-of select="/clientsplugin/client/name"/></h1>
        <!-- actually do something clever with the input XML.... -->