Biz(Talk)2

Talk, talk and more talk about BizTalk

Sending attachments through a Dynamic Send Port

I spent a bit of time getting a Dynmic Send Port to email a message to a recipient as a text attachment (regardless of the filename suffix).  The following documents the properties that need to be set on the message, and corresponding send port.
  1. Create the message (“msgEnvelope”) as a Multi-Part message, with the required message in the Message Body Part (“Attachment”)
  2. Set the following properties of the Envelope Message:
      msgEnvelope(SMTP.Subject) = <Email Subject>;
      msgEnvelope(SMTP.From) = <Sender Email>;
      msgEnvelope(SMTP.SMTPHost) = <Email Host name>";
      // This is the default value
      msgEnvelope(SMTP.SMTPAuthenticate) = 0;
      // Set the message text included in the email
      msgEnvelope(SMTP.EmailBodyText) = <Text in body of email>;
      // Important - This is required if the EmailBodyText is set
      msgEnvelope(SMTP.EmailBodyTextCharset) = "utf-8";
      // A value of '1' means include Message Body Part as email attachment
      msgEnvelope(SMTP.MessagePartsAttachments) = 1;
  3. Set the following properties of the Message Body Part (“Attachment”):
      // Important - Change this MIME type if not sending a Text file
      msgEnvelope.Attachment(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";
      // Set the Filename of the attachment
      msgEnvelope.Attachment(MIME.FileName) = <Physical name of the attachment>;
  4. Set the following property on the Dynamic Send Port:
      // We set the Email Address on the Port itself
      Dynamic_Send_Port(Microsoft.XLANGs.BaseTypes.Address) = <recipient email address>;

The Send Port is then configured to use a custom Send Pipeline containing a Flat File assembler for the message schema to convert the message into the flat file.

Advertisements

August 28, 2008 - Posted by | BizTalk |

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: