Hi @Steve Linn and all,
I have a requirement to initiate mail To: (multiple mail IDs) and adding cc: (multiple users) as well. However my code is working fine while I am sending to 1 user. Any help from anyone will be highly appreciated to fulfil my requirement. The following is sample xslt snippet.
<xsl:value-of select="mime:sendBodyWithAttachment(
'smtp.gmail.com',
'xxx@x.com',
'yyy.x@x.com',
'datapower.ibm.com',
'email with attachment 8',
$html,
dp:binary-encode($gif/result/binary),
'image/gif',
'anim.gif'
)"/>
</xsl:template>
<!-- some constants -->
<xsl:variable name="CRLF" select="' '"/>
<xsl:variable name="DDASH" select="'--'"/>
<xsl:variable name="QUOT" select="'"'"/>
<!-- MIME base64 data maximal line length is 76 characters -->
<func:function name="mime:split64">
<xsl:param name="str"/>
<func:result>
<xsl:value-of select="concat(substring($str,1,76),$CRLF)"/>
<xsl:if test="string-length($str) > 76">
<xsl:value-of select="mime:split64(substring($str,77))"/>
</xsl:if>
</func:result>
</func:function>
<!-- send email with HTML body and an attachment -->
<func:function name="mime:sendBodyWithAttachment">
<xsl:param name="exchange"/>
<xsl:param name="to"/>
<xsl:param name="from"/>
<xsl:param name="domain"/>
<xsl:param name="subject"/>
<xsl:param name="html"/>
<xsl:param name="att"/>
<xsl:param name="coty"/>
<xsl:param name="fname"/>
<!-- prepare HTML email body for sending -->
<xsl:variable name="serializedHTMLData">
<dp:serialize select="$html" omit-xml-decl="yes"/>
</xsl:variable>
<!-- as the name says, get us a unique MIME boundary -->
<xsl:variable name="boundary" select="dp:generate-uuid()"/>
<!-- trick to make this working in func:function -->
<xsl:variable name="dummy">
<dp:url-open response="ignore" target="{concat(
'dpsmtp://',
dp:encode($exchange,'url'),
':587/?To=',
dp:encode($to,'url'),
'&From=',
dp:encode($from,'url'),
'&Subject=',
dp:encode($subject,'url'),
'&Domain=',
dp:encode($domain,'url'),
'&MIME=true'
)}">
<xsl:value-of disable-output-escaping="yes" select="concat('MIME-Version: 1.0',$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="concat('Content-type: multipart/mixed; boundary=',$QUOT)"/>
<xsl:value-of disable-output-escaping="yes" select="concat($boundary,$QUOT,$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="concat($CRLF,$CRLF,$DDASH,$boundary,$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="concat('Content-type: text/html',$CRLF,$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="$serializedHTMLData"/>
<xsl:value-of disable-output-escaping="yes" select="concat($CRLF,$DDASH,$boundary,$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="concat('Content-type: ',$coty,$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="concat('Content-Transfer-Encoding: base64',$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="concat('Content-Disposition: attachment;')"/>
<xsl:value-of disable-output-escaping="yes" select="concat(' filename=',$fname,';',$CRLF,$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="mime:split64($att)"/>
<xsl:value-of disable-output-escaping="yes" select="concat($DDASH,$boundary,$DDASH,$CRLF)"/>
<xsl:value-of disable-output-escaping="yes" select="concat('epilogue',$CRLF)"/>
</dp:url-open>
Also, Is there any possibility to implement the same using gatewayscript?
Thankyou in Advance!
------------------------------
Stefen Salvatore
------------------------------