Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon 692 posts 1068 karma points
    Jan 27, 2015 @ 16:32
    Simon
    0

    Contour Email Template

    Hi,

    I got stucked because I would like to know where in Umbraco contour can chnage the email template when template is being sent?

    For example, inlcuding a logo in the email template and also change the text to include in the email.

    Appreciate any help!

    Regards

     

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 27, 2015 @ 16:35
    Dennis Aaen
    100

    Hi Simon,

    If you follow this path in your Umbraco installation /Umbraco/Plugins/umbracoContour/xslt then you will find the XSLT file that Contour uses to send the email. The file is named sendXsltEmailSample.xslt.

    Hope this helps,

    /Dennis

  • Simon 692 posts 1068 karma points
    Jan 27, 2015 @ 16:43
    Simon
    0

    Hi Dennis,

    Thank you for your fast reply.

    The email credentials that umbraco will use to send email from, are those found in the web.config in the smtp section?

    Thank you

    Regards

  • Simon 692 posts 1068 karma points
    Jan 27, 2015 @ 16:54
    Simon
    0

    Hi Dennis,

    I have tried sending a form but the text was different from the actual email text from that of the suggested .xslt file that you have told me.

    Are there another file which umbraco uses to exchnage the email message, email subject, etc.?

    Thank you.

    Regards

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 27, 2015 @ 17:50
    Dennis Aaen
    0

    Hi Simon,

    For you question about the email credentials that umbraco use to  send email from, it´s add in the web.config file in the SMTP section. And you also need to add the email in the /config/umbracoSettings.config.

    <notifications>
          <!-- the email that should be used as from mail when umbraco sends a notification -->
          <email>[email protected]</email>
    </notifications>

    If you're not using it already you should try to use http://smtp4dev.codeplex.com/ with this tool it makes it easier to do e-mail testing when sending on localhost.

    And for you question about where to change the email message, email subject, etc. try to see this documentation about attaching workflows and you need to do this for the workflow called Submitted http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Editor/Attaching-Workflows/

    Hope this helps, don't hesitate to ask again and I will see if I can help you.

    /Dennis

  • Simon 692 posts 1068 karma points
    Jan 27, 2015 @ 18:12
    Simon
    0

    Hi Dennis,

    Do you know where these inputs, such as message subject etc, which file is being used in order to generate the email template tough? 

     

    Regards

     

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 27, 2015 @ 19:43
    Dennis Aaen
    0

    Hi Simon,

    I have investigated where to find the inputs, such as message subject etc, which file is being used in order to generate the email template. And I don´t think that you can get access to it.

    But what you can do is to set the workflow type to Send xslt transformed email, and then you have full control over the email contents by supplying an xslt file http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Editor/Attaching-Workflows/#Sendxslttransformedemail and if you do this then you need to make your changes into the file that I posted in my first post. /Umbraco/Plugins/umbracoContour/xslt/sendXsltEmailSample.xslt.

    Hope this helps,

    /Dennis

  • Simon 692 posts 1068 karma points
    Jan 30, 2015 @ 12:55
    Simon
    0

    Hi Dennis,

    I have encountered a problem when trying to send email, on form submission, to different email addresses, regarding email template in .xslt file.

    Currently, I have this part of the code, which compate dropdown value and send email accordingly:-

    <xsl:when test="$dropdownlistValue = 2">

                    <xsl:value-of select="umbraco.library:SendMail(
                        '[email protected]',
                        $receiverEmailSubject2,
                        $enquiryFormEmailSubject,
                        $bodyText, 
                        1
                    )"/>
               </xsl:when>
     
    Now, I cannot find a way how the $bodyText , which is a variable, include in it such as HTML tags and also even images which I may read from the CMS.
     
    So basically, I require a way how I can send the mail and pass a variable that contains the actual email template, including images such as company logo.
     
    When I tried, both HTML and even images were not being considered when email was sent. Just text.
     
    Appreaciate any guidance, as always did :)
     
    thank you.
     
    Regards

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 31, 2015 @ 01:04
    Dennis Aaen
    0

    Hi Simon,

    I assume that you already are able to get data from the field where the $bodyText variable refers to. I think you need to add the add the disable output escaping to where you write out the data. I think this code below show how you can build up your email. And of cause it possible for you to get the data from Umbraco pages.

    You can read more about disable output escaping here: http://www.w3schools.com/xsl/el_value-of.asp

    Here is an exampe on how you can wrap the bodyText variable.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library"xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"xmlns:umbraco.contour="urn:umbraco.contour"
      exclude-result-prefixes="msxml
     umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes
    Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings
    Exslt.ExsltSets umbraco.contour "
    >


    <xsl:outputmethod="xml"omit-xml-declaration="yes"/>

    <xsl:paramname="currentPage"/>
    ata/fields/texte//value"/>
     
    <!-- XSLT  -->
    <xsl:templatematch="/">

    <!--Email part-->
     
    <xsl:variablename="bodyText">
      <xsl:textdisable-output-escaping="yes"><![CDATA[
      <divid="carte"style="width:600px; height:300px; background:#f0f0f0;">
      <divid="image"style="float:left; width:350px; height:300px; background:#f0fff0;">Image</div>
      <divid="titre"style="float:left; width:150px; height:50px; background:#00ff00;">]]></xsl:text><xsl:value-ofselect="$ecardTitre"/><xsl:textdisable-output-escaping="yes"><![CDATA[</div>
      <divid="timbre"style="float:left; width:100px; height:50px; background:#ff00ff;">Timbre</div>
      <divid="texte"style="float:left; width:250px; background:#98765f;">
        <p>Cher ]]></xsl:text><xsl:value-ofselect="$ecardTo"/><xsl:textdisable-output-escaping="yes"><![CDATA[,</p>
        <p>]]></xsl:text><xsl:value-ofselect="$ecardTexte"/><xsl:textdisable-output-escaping="yes"><![CDATA[</p>
        <pstyle="text-align:right">]]></xsl:text><xsl:value-ofselect="$ecardFrom"/><xsl:textdisable-output-escaping="yes"><![CDATA[</p>
      </div>
      </div>
      ]]></xsl:text>
    </xsl:variable>

    <!-- the sendmail -->

      <xsl:value-ofselect="umbraco.library:SendMail('[email protected]', $receiverEmailSubject2, $enquiryFormEmailSubject, $bodyText, true())"/>
     
    </xsl:template>
    </xsl:stylesheet>

    Remember if you are using images in your email you need to use absolute path to the urls of the images..

    Hope this helps, and answers your question.

    /Dennis

  • Simon 692 posts 1068 karma points
    Jan 31, 2015 @ 17:47
    Simon
    0

    Thank you dennis, I will try it out.

    Can you please guide me how can I insert an image, from CMS, such as company logo, in xslt as part of the bodyText variable to include it in my email?

    thank you in advance

    Regars

  • Simon 692 posts 1068 karma points
    Feb 02, 2015 @ 11:31
    Simon
    0

    Any ideas pls?

    thank you.

    Regards

Please Sign in or register to post replies

Write your reply to:

Draft