The built-in Contour workflows automatically send From the address defined in umbracoSettings.config. In order to change the from address you'd need to create your own custom workflow. The Contour Contrib has workflows that allow you to set the "Reply To" address but not the actual "From" address.
I tried the Contour Contrib workflow, but I got an "Object reference" error and no additional details in the log, so I abandoned that and went with the XSLT transformed email:
Like I said, I almost have it, the email does send, it's just the From address value that's incorrect. My xpath is wrong, I'm just not sure how to pull the value and not the whole section.
Cheers for your help guys, Fuji's suggestion works for me. I thought Tom's would as well as "$records//fields/emailaddress" gets me something, but unfortunately it didn't.
XSLT transformed email - umbraco.library:SendEmail custom From address?
Hello,
I'm trying to send an email from the Send XSLT transformed email workflow in Contour and pull the From address from the form values.
I have it sending the email, but I'm not sure how to pull the value I want. Here is my XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 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" exclude-result-prefixes="xsl msxsl user umbraco.library">
<xsl:output method="html" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="DTD/xhtml1-strict.dtd" cdata-section-elements="script style" indent="yes" encoding="utf-8"/>
<xsl:param name="records" />
<xsl:template match="/">
<xsl:variable name="bodyText">
<xsl:for-each select="$records//fields/child::*">
<strong><xsl:value-of select="./caption" />: </strong><xsl:value-of select=".//value" /><br /><br />
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$bodyText"/>
<xsl:variable name="fromEmail" select="$records//fields/emailaddress"/>
<xsl:value-of select="umbraco.library:SendMail($fromEmail, '[email protected]', 'Subject', $bodyText, 'true')"/>
</xsl:template>
</xsl:stylesheet>
The email does send, but the fromEmail value comes through as:
"40082670-9ce5-4192-99ee-0471be99569a0a13ae86-f0d0-4329-9365-27eb646891f7Email addressStringgreg"@domain.com
Any suggestions?
Thanks,
Greg.
Hi Greg,
The built-in Contour workflows automatically send From the address defined in umbracoSettings.config. In order to change the from address you'd need to create your own custom workflow. The Contour Contrib has workflows that allow you to set the "Reply To" address but not the actual "From" address.
-Tom
Are u sure : $records//fields/emailaddress only gets an email, it looks like it has childnodes.
What's in the mail when u take this mailbody:
<xsl:variable name="bodyText">
<xsl:for-each select="$records//fields/emailaddress">
<strong><xsl:value-of select="./name()" />: </strong><xsl:value-of select="." /><br /><br />
</xsl:for-each>
</xsl:variable>
/J
Hi Tom,
I tried the Contour Contrib workflow, but I got an "Object reference" error and no additional details in the log, so I abandoned that and went with the XSLT transformed email:
http://our.umbraco.org/forum/umbraco-pro/contour/15723-Sending-email-to-certain-email-address-dependent-on-selection-in-form
Like I said, I almost have it, the email does send, it's just the From address value that's incorrect. My xpath is wrong, I'm just not sure how to pull the value and not the whole section.
@Jacob, 2 minutes, let me try that.
Cheers,
Greg.
foreach - > $records//fields/emailaddress/*
Oh sorry, I didn't realize you were sending the email from the actual XSLT file. Never thought of that :)
I think to get the actual value of a field you want to pull the value element:
-Tom
You could try this, but when adding the caption email address remember to put it correctly as its case sensitive
//fuji
Excellent.
Cheers for your help guys, Fuji's suggestion works for me. I thought Tom's would as well as "$records//fields/emailaddress" gets me something, but unfortunately it didn't.
Cheers again,
Greg.
is working on a reply...