x First time here? Check out the FAQ
Join us a the Umbraco event of the year - get your Codegarden 14 early bird ticket today
  • Avatar122posts148karma

    XSLT to generate plain text email

    Søren Reinke started this topic June 28, 2011 @ 01:21, Go directly to the topic solution

    Hi there

    Has any of you a XSLT file for generating pure plain text emails when a form is submitted in Contour ?

    I just need the field to be outputtet as:

     

    Company Name Name

    Company Address Road 117

     

    and so forth.

     

    I tried to make my own XSLT, but it looks like the formatting is still html, and therefore the linefeeds are not being shown.


    I used this XSLT

     

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-scripts" xmlns:umbraco.library="urn:umbraco.library" version="1.0" exclude-result-prefixes="xsl msxsl user umbraco.library">
        <xsl:output method="text" encoding="utf-8" media-type="text/plain"/>
        <xsl:param name="records"/>
        <xsl:template match="/">
            <xsl:for-each select="$records//fields/child::*">
                <xsl:value-of select="./caption"/>
                <xsl:text>&#9;</xsl:text>
                <xsl:value-of select=".//value"/>
                <xsl:text>&#xa;</xsl:text>
            </xsl:for-each>
        </xsl:template>
    </xsl:stylesheet>

    I get this output, when view source in outlook:

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">Field1   1234
    Field2 345

     

    Hope you can help.

     


  • Tom Fulton posted this reply June 28, 2011 @ 02:06

    Hi,

    I believe the built in "Send email" workflow hardcodes the MailMessage to use HTML.  If you want to use plain text, you might need to create a custom workflow

    -Tom


  • Avatar122posts148karma
    Comment with ID: 81410
    Søren Reinke posted this reply June 28, 2011 @ 02:14

    Hi Tom

    I was afraid of that.

    Hopefully they will fix that (in my oppinion) design error in a later version. 


Please login or Sign up To post replies