Copied to clipboard

Flag this post as spam?

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


  • Profiterole 232 posts 264 karma points
    Mar 03, 2011 @ 15:40
    Profiterole
    0

    sendMail send email twice

    Hi, I have this line in my xslt :

    <xsl:value-of select="umbraco.library:SendMail('[email protected]', $ecardEmailTo, $ecardTitre, $ecardTextEmail, 'true')/>

    It always send two copy of the email. Why?

    Thank you

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 03, 2011 @ 15:56
    Lee Kelleher
    1

    Hi Profiterole,

    The code for SendMail only sends one email out... there might be something else going on in your template?

    E.g. duplicate recipients in the "$ecardEmailTo"?  or multiple calls to SendMail? (is the macro being included on your page twice?)

    Cheers, Lee.

  • Profiterole 232 posts 264 karma points
    Mar 03, 2011 @ 16:29
    Profiterole
    0

    Thanks for your quick reply!

    I change $ecardEmailTo for my email, so it can't be duplicate recipients. In my xslt, there's only one instance of sendmail and the macro is called only one on my textpage.

    But it keeps to send email twice?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 03, 2011 @ 16:40
    Lee Kelleher
    1

    Hi 

    That's a strange one... haven't heard of this before.  My feeling is that it might be a mail server / config issue? (but can't say with any certainy, sorry).

    Taking a long-shot here... could you try changing the last parameter (IsHtml) to use a boolean (rather than a string)?

    <xsl:value-of select="umbraco.library:SendMail('[email protected]', $ecardEmailTo, $ecardTitre, $ecardTextEmail, true())/>
    

    Cheers, Lee.

  • Profiterole 232 posts 264 karma points
    Mar 03, 2011 @ 18:17
    Profiterole
    0

    Ok, I'll look for at mail server. I tried to change to boolean. Nothing has change.

    Thank for your help anyway!!

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 03, 2011 @ 20:47
    Kim Andersen
    1

    Like Lee says, this sounds very strange. Maybe you could show us your whole XSLT code for this file. There might be something else going on somewhere else in the file. I know it's a long shot, but just to be absolutely sure :)

    /Kim A

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 03, 2011 @ 21:28
    Jan Skovgaard
    0

    Hmm, sounds like the "submit" event is somehow triggered twice..are you using some JavaScript to do this?

    /Jan

  • Profiterole 232 posts 264 karma points
    Mar 04, 2011 @ 00:49
    Profiterole
    0

    Hi guys,

    So the macro is inserted in a textpage and call xslt below. In Contour users fill a form (ecard.aspx), then they are redirected to ecard-post.aspx. On this page, there's a view of the ecard that is send to receiver.

    Here's the xslt :

    <?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:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
        
    <xsl:variable name="ecardID" select="umbraco.library:RequestQueryString('recordid')" />
    <xsl:variable name="ecardData" select="umbraco.contour:GetRecord($ecardID)"/>

        <xsl:variable name="ecardChoix" select="$ecardData/fields/choisissezvotremodèledecarte//value"/>
        <xsl:variable name="ecardFrom" select="$ecardData/fields/prénom//value"/>
        <xsl:variable name="ecardEmailFrom" select="$ecardData/fields/votrecourriel//value"/>
        <xsl:variable name="ecardTo" select="$ecardData/fields/prénomderécepteur//value"/>
        <xsl:variable name="ecardEmailTo" select="$ecardData/fields/courrieldurécepteur//value"/>
        <xsl:variable name="ecardTitre" select="$ecardData/fields/grostitre//value"/>
        <xsl:variable name="ecardTexte" select="$ecardData/fields/texte//value"/>
      
    <!-- XSLT  -->
    <xsl:template match="/">

    <!-- Preview on the page -->
    <div id="carte" style="width:600px; height:300px; background:#f0f0f0;">
      <div id="image" style="float:left; width:350px; height:300px; background:#f0fff0;">Image</div>
      <div id="titre" style="float:left; width:150px; height:50px; background:#00ff00;"><xsl:value-of select="$ecardTitre"/></div>
      <div id="timbre" style="float:left; width:100px; height:50px; background:#ff00ff;">Timbre</div>
      <div id="texte" style="float:left; width:250px; background:#98765f;">
        <p>Cher <xsl:value-of select="$ecardTo"/>,</p>
        <p><xsl:value-of select="$ecardTexte"/></p>
        <p style="text-align:right"><xsl:value-of select="$ecardFrom"/></p>
      </div>
    </div>
     
      <!--Email part-->
     
    <xsl:variable name="ecardTextEmail">
      <xsl:text disable-output-escaping="yes"><![CDATA[
      <div id="carte" style="width:600px; height:300px; background:#f0f0f0;">
      <div id="image" style="float:left; width:350px; height:300px; background:#f0fff0;">Image</div>
      <div id="titre" style="float:left; width:150px; height:50px; background:#00ff00;">]]></xsl:text><xsl:value-of select="$ecardTitre"/> <xsl:text disable-output-escaping="yes"><![CDATA[</div>
      <div id="timbre" style="float:left; width:100px; height:50px; background:#ff00ff;">Timbre</div>
      <div id="texte" style="float:left; width:250px; background:#98765f;">
        <p>Cher ]]></xsl:text><xsl:value-of select="$ecardTo"/><xsl:text disable-output-escaping="yes"><![CDATA[,</p>
        <p>]]></xsl:text><xsl:value-of select="$ecardTexte"/><xsl:text disable-output-escaping="yes"><![CDATA[</p>
        <p style="text-align:right">]]></xsl:text><xsl:value-of select="$ecardFrom"/><xsl:text disable-output-escaping="yes"><![CDATA[</p>
      </div>
    </div>
    ]]></xsl:text>
    </xsl:variable>

    <!-- the sendmail -->

      <xsl:value-of select="umbraco.library:SendMail('[email protected]', $ecardEmailTo, $ecardTitre, $ecardTextEmail, true())"/>
     
    </xsl:template>
    </xsl:stylesheet>

    Hope you can see something!

  • Profiterole 232 posts 264 karma points
    Mar 04, 2011 @ 00:51
    Profiterole
    0

    @Jan : My goal is to be able to preview the ecard before the user send it. But for now, I'm just trying (discovering) things!

  • Dan 1288 posts 3921 karma points c-trib
    May 16, 2012 @ 16:15
    Dan
    2

    I know this is a really old thread, but just for the record...  I thought I had this just now.  The system seemed to be sending sometimes 2 or 3 copies of the email.  What it turned out to be is that if you save your XSLT in the Umbraco XSLT editor, the save event triggers all XSLT exensions (which are being used) to be run.  Hence saving the script results in the email being sent.

    So if you save in the editor, preview the template which is calling the macro, then check your email, you'll get 2 of the same emails.

    One to watch out for, and possibly the cause of the issue for @Profiterole.

  • Bo Kingo Damgaard 157 posts 456 karma points
    Apr 23, 2013 @ 10:13
    Bo Kingo Damgaard
    1

    This is an old thread, but I think it's a bug in Umbraco that is present in both 4.7.x and 6.0.3 where I've seen it.

    It seems that if you insert the macro in the RTE on a page it gets called twice, BUT only rendered once. If you insert the same macro in the template, it's only called once. I think that could have a performance hit, if all RTE macros are called twice, if they are slow

    I've reported the issue here: http://issues.umbraco.org/issue/U4-2139

    /Bo

Please Sign in or register to post replies

Write your reply to:

Draft