According to the Microsoft definition about configuring a SMTP port (
http://msdn.microsoft.com/en-us/library/aa578155(BTS.20).aspx):
If the property is set in an orchestration or in a custom pipeline component in a receive pipeline, then:
- If the message is sent to a static send port, the property value will be overwritten with the value configured for that send port.
- If the message is sent to a dynamic send port, the property value will not be overwritten.
If the property is set in a custom pipeline component in a send pipeline, then:
- The value will not be overwritten regardless of whether the message is sent to a static or dynamic send port.
And we want to give a dynamic behaviour inside our orchestration to our static SMTP send port, we need to implement three items: a pipeline component, a send pipeline and a property schema. We need also, set the properties inside the orchestration that uses the static SMTP port.
1. The Property Schema
We have to define a property schema, with the properties we want to give a dynamic behaviour in the static SMTP port, for example:
2. The Pipeline Component (SMTPPropertiesComponent)
We implement a pipeline component to map the value (in the message's context) of the properties of our property schema, to the properties of SMTP schema. In the IComponent's Execute method we do this mapping:
object oEmailText = pInMsg.Context.Read(EMAIL_TEXT_PROPERTY, CUSTOM_PROPERTY_SCHEMA_NAMESPACE);
object oAttachmentName = pInMsg.Context.Read(ATTACHMENT_NAME_PROPERTY, CUSTOM_PROPERTY_SCHEMA_NAMESPACE);
object oRemainingParts = pInMsg.Context.Read(REMAINING_PARTS_PROPERTY, CUSTOM_PROPERTY_SCHEMA_NAMESPACE);
object oFrom = pInMsg.Context.Read (CUSTOM_FROM_PROPERTY, CUSTOM_PROPERTY_SCHEMA_NAMESPACE);
object oTo = pInMsg.Context.Read (CUSTOM_TO_PROPERTY, CUSTOM_PROPERTY_SCHEMA_NAMESPACE);
object oSubject = pInMsg.Context.Read (CUSTOM_SUBJECT_PROPERTY, CUSTOM_PROPERTY_SCHEMA_NAMESPACE);
object oCC = pInMsg.Context.Read (CUSTOM_CC_PROPERTY, CUSTOM_PROPERTY_SCHEMA_NAMESPACE);
if (oEmailText != null)
pInMsg.Context.Write(EMAIL_BODY_TEXT_PROPERTY, SMTP_PROPERTY_SCHEMA_NAMESPACE, oEmailText);
if (oAttachmentName != null)
pInMsg.BodyPart.PartProperties.Write(FILE_NAME_PROPERTY, MIME_PROPERTY_SCHEMA_NAMESPACE, oAttachmentName);
if (oFrom != null)
pInMsg.Context.Write(FROM_PROPERTY, SMTP_PROPERTY_SCHEMA_NAMESPACE, oFrom);
if (oSubject != null)
pInMsg.Context.Write(SUBJECT_PROPERTY, SMTP_PROPERTY_SCHEMA_NAMESPACE, oSubject);
if (oCC != null)
pInMsg.Context.Write(CC_PROPERTY, SMTP_PROPERTY_SCHEMA_NAMESPACE, oCC);
if (oTo != null)
pInMsg.Context.Write(OUTBOUND_TRANSPORT_LOCATION, SMTP_PROPERTY_SCHEMA_NAMESPACE, string.Format("mailto:" + oTo));
if (oRemainingParts != null)
pInMsg.Context.Write(MESSAGE_PARTS_ATTACHMENTS_PROPERTY, SMTP_PROPERTY_SCHEMA_NAMESPACE, (uint)oRemainingParts);
return pInMsg;
3. The Pipeline
In the send pipeline, we only need to use our pipeline component.
4. The Orchestration
In the orchestration, in the construct shape of the message to send, we set our custom values: