正文部分作为附件在biztalk动态SMTP发送端口中发送

问题描述 投票:0回答:1

电子邮件正在使用biztalk SMTP动态发送端口将正文与附件一起发送。

将C#助手类用作:

namespace OutputStringContent
{
    [Serializable]
    public class SMTPTestHelper
    {
        public static XLANGMessage AttachStreamToSmtpMessage(XLANGMessage xlangMsg, String strAttach)
        {
            byte[] memBuffer = Encoding.ASCII.GetBytes(strAttach);
            IStreamFactory streamFactory = new BinaryStreamFactory(new MemoryStream(memBuffer));
            xlangMsg.AddPart(streamFactory, "AttachedMessage");
            xlangMsg["AttachedMessage"].SetPartProperty(typeof(Microsoft.XLANGs.BaseTypes.ContentType), "text/plain; name=text.txt");

            return xlangMsg;
        }
    }
}

在业务流程中的消息分配形状中:

msgSendEmail.MessagePart_1 = new OutputStringContent.RawString(msgEmail.EmailBody);
msgSendEmail.MessagePart_1(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";
msgSendEmail = OutputStringContent.SMTPTestHelper.AttachStreamToSmtpMessage(msgSendEmail,msgEmail.EmailAttachements);

msgSendEmail(SMTP.From) = msgEmail.EmailFrom;
msgSendEmail(SMTP.SMTPTo) = msgEmail.EmailTo;
msgSendEmail(SMTP.Subject) = msgEmail.EmailSubject;
//msgSendEmail(SMTP.EmailBodyText) = msgEmail.EmailBody;
msgSendEmail(SMTP.EmailBodyTextCharset) = "UTF-8";
msgSendEmail(SMTP.MessagePartsAttachments) = 2;

msgSendEmail(SMTP.SMTPHost) = "smtp1.tucaas.com";
msgSendEmail(SMTP.SMTPAuthenticate) = 0;

Port_SendEmail(Microsoft.XLANGs.BaseTypes.Address) = "mailto:"+msgEmail.EmailTo;

预期结果:电子邮件不应带有正文作为附件。

c# email dynamic smtp biztalk
1个回答
0
投票

向发送端口管道中添加“ MIME / SMIME编码器”管道组件,并将“发送正文部分作为附件”属性设置为“ False”。 that enter image description here应该可以解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.