【问题标题】:url-open smtp mime attachment issueurl-open smtp mime 附件问题
【发布时间】:2011-07-05 02:11:42
【问题描述】:

尝试在 XI50 固件 3.8.2 上使用样式表中的 url-open 构建并通过 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 标题和文本内容作为电子邮件中的文本到达,没有创建附件。

我是否遗漏了什么,我需要做什么才能让电子邮件创建附件??

感谢您的帮助....

【问题讨论】:

    标签: ibm-datapower


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2011-12-20
      • 2011-09-11
      • 2015-02-26
      • 2021-11-05
      • 2011-08-25
      • 2011-09-16
      • 2020-03-12
      • 2021-08-19
      • 2017-08-30
      相关资源
      最近更新 更多