Trying to use url-open from a stylesheet to build and send an e-mail with attachment via smtp on an XI50 firmware 3.8.2. Can't seem to get the attachment to work.... The content of the attachment and the mime headers appear as ordinary text in the mail message.
The xsl.... (this is just something simple to prove the concept so far)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:dp="http://www.datapower.com/extensions"
extension-element-prefixes="dp"
exclude-result-prefixes="dp">
<xsl:output method="xml" version="1.0" standalone="yes"/>
<xsl:template match="/">
<xsl:variable name="emailServer">smtp0.mycompany.com</xsl:variable>
<xsl:variable name="domain">mycompany.com</xsl:variable>
<xsl:variable name="mimeStuff">
MIME-Version: 1.0
Content-Disposition: attachment; filename="stuff.txt"
Content-Type: text/plain
Here is some text for the attachment.
</xsl:variable>
<xsl:variable name="msgSender">someone@mycompany.com</xsl:variable>
<xsl:variable name="msgSubject">NON MULTIPART - <xsl:value-of select="date:date-time()"/></xsl:variable>
<!-- URL encode the values before building the url-open function -->
<xsl:variable name="encSender" select="dp:encode($msgSender,'URL')"/>
<xsl:variable name="encRecipient" select="dp:encode(dp:variable('var://context/msgRtr/emailRecipient'),'URL')"/>
<xsl:variable name="encSubject" select="dp:encode($msgSubject,'URL')"/>
<xsl:variable name="smtpURL">smtp://<xsl:value-of select="$emailServer"/>:25/?MIME=true&Domain=<xsl:value-of select="$domain"/>&Recpt=<xsl:value-of select="$encRecipient"/>&Sender=<xsl:value-of select="$encSender"/>&Subject=<xsl:value-of select="$encSubject"/></xsl:variable>
<xsl:variable name="resultSet"><dp:url-open target="{$smtpURL}" response="responsecode-ignore"><xsl:value-of select="$mimeStuff"/></dp:url-open></xsl:variable>
</xsl:template>
</xsl:stylesheet>
The smtp call works, an email arrives, but the mime headers and text content of the attachment arrive as text in the e-mail, no attachment is created.
Am I missing something, what do I need to do to have the e-mail create an attachment ??
Thanks for your help....