Send Email from SMTP Adapter via a Dynamic Port in BizTalk Server
Send Email from SMTP Adapter via a
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.
Configure the
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.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2006-01-21 Enterprise Library for .NET Framework 2.0 Released!!!