|
I needed to send an email directly from BTS 2004; this was part of an error handling mechanism. However going through a Schema was too much all I needed is to be able to assemble a string and send it through a SMTP port. As you know E-mail messages always contain message text, generally in a text or html format, and may contain one or more attachments as well. I needed to send the Email in HTML format. After going through the SDK and the documentation, I could not find an easy well documented solution for this. So I had to assemble the solution attached with this submission.
Sending a message of type System.String will not work, because the string gets formatted as an XML document in the message, which is not my desired solution. To send text in an e-mail message, you must use a special type of string, a string that has special serialization with the XML, in other words implements IFormatter interface. In the attached solution you will find class “RawString” which implements IFormatter. You also need to implement a pipeline containing the MIME/SMIME Encoder pipeline component. Now we have to tell the MIME/SMIME pipeline component that it is dealing with a body with content type of text/html through
The Microsoft.XLANGs.BaseTypes.XLANGPart.SetPartProperty method.
So the solution consists of
- A library class that contains the RawString class and Part class to make it easy to set the type of the message
- A BTS project that contain a pipeline to use for sending the email.
- A simple orchestration that accepts a simple file schema and just sends the email. The input file in this example is empty it is just used to fire the orchestration.
Hope this would make your development project easier. Let me know what you think . You can download the code from the downloads and Samples
|