Send Email from SMTP Adapter via a Dynamic Port in BizTalk Server

本文介绍如何在BizTalk Server中使用SMTP发送适配器通过动态端口发送邮件,包括设置SMTP属性的方法及如何根据消息内容进行配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Send Email from SMTP Adapter via a <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />DynamicPort in BizTalk Server<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

Implementing the SMTP send adapter to send an email from BizTalk requires SMPT configuration information, such as SMTP server and receipient email address. Rather tha specifying the configuration information at design time, we can use a dynamic port, which allows us to configure the information programmatically and modify it based on the message content or processing.

 

The target URL can be assigned to a dynamic port using the Expression shape.

For example:

myPort(Microsoft.XLANGS.BaseTypes.Address) = http://orders.myCompany;

 

Code snippet in the Message Assignment shape:

// Construct Message

msgSend = msgInEmail;

Note: Messages are immutable in BizTalk Server. If you want to modify a message, you must use a Construct shape to create a new message, copy the original message to the new message, and then update the fields on the new message.

 

// Set the SMTP properties based on message content.

// Reference the send port to set properties.

portSendEmail(Microsoft.XLANGs.BaseTypes.Address) = "mailto:rickie4you@rickie.com";

 

msgSend(SMTP.EmailBodyTextCharset)="UTF-8";

msgSend(SMTP.CC) = " rickie4you@rickie.com";

msgSend(SMTP.Subject) = "Send an email via BizTalk SMPT Adapter";

msgSend(SMTP.EmailBodyText) = msgInEmail.MailBody;

msgSend(SMTP.From) = "BizTalk@rickie4you.com";

msgSend(SMTP.SMTPHost) = "SMTP SERVER";

msgSend(SMTP.Username) = "USERNAME";

msgSend(SMTP.Password) = "PASSWORD";

msgSend(SMTP.SMTPAuthenticate) = 1;

 

The demo orchestration is as follows.

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />

DynamicPortDemo.JPG
Configure the SendPort as a Dynamic port, which allows the physical location of a physical send port to be determined at runtime.

When the orchestration is deployed, the relevant physical send port will be created automatically, and specific binding of the orchestration to a physical send port is already done.

 

 

转载于:https://www.cnblogs.com/rickie/archive/2007/01/21/626183.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值