The new SMTP adapter provides the facility to send text/plain messages without using external classes or having more hazel.
Create a Message to be send which is of type System.String. Set the message SMTP values as follows in a Message Assignment shape.
EmailMessage = System.String.Empty;
EmailMessage(SMTP.Subject) = "Hello World!";
EmailMessage(SMTP.EmailBodyText) = "My Test Message"; // Text message body.
EmailMessage(SMTP.EmailBodyTextCharset) = "UTF-8";
EmailMessage(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";
SMTPSendPrt(Microsoft.XLANGs.BaseTypes.Address) = "mailto:email@example.com";
In the above case I am using a dynamic send port, so I need to set the send port address before I send the message.
Microsoft.XLANGs.BaseTypes.Address , is used to set the address location of the message. You have to use "mailto:", as specified above in the address location.
If you have to send messages to more than one person, you can either set the "SMTP.CC" property, or you can use a ';' to delimit the email addresses.
SMTP.EmailBodyTextCharset is by default set as 'None', so has to be set explicitly to 'UTF-8'. Otherwise, BizTalk will throw strange run time errors.
Post any comments if you have. Enjoy!