url-open smtp mime附件问题

时间:2011-07-05 02:11:42

标签: ibm-datapower

尝试使用样式表中的url-open在XI50固件3.8.2上通过smtp构建和发送附件的电子邮件。似乎无法使附件工作....附件和mime标题的内容在邮件消息中显示为普通文本。

xsl ....(到目前为止,这只是简单的证明这个概念)

<?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&amp;Domain=<xsl:value-of select="$domain"/>&amp;Recpt=<xsl:value-of select="$encRecipient"/>&amp;Sender=<xsl:value-of select="$encSender"/>&amp;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>

smtp调用有效,电子邮件到达,但附件的mime标题和文本内容以电子邮件中的文本形式到达,未创建附件。

我错过了什么,我需要做些什么才能让电子邮件创建附件?

感谢您的帮助......

1 个答案:

答案 0 :(得分:0)

刚刚发布了解决方案 sending emails with attachments