Sending multiple attachments with SMTP Adapter

Link. March 5, 2007. Comments [0]. Posted in: BizTalk

I've received a number of questions regarding a sample I posted a while ago: Arbitrary Binary Attachments to Multi-Part Messages; mostly related to issues when sending the resulting messages through the SMTP adapter and not all attachments (or no attachments at all) getting to the destination account.

I've found that usually, this is the result of setting the SMTP.MessagePartsAttachments property to the wrong value. In the sample I posted alongside the article, I was setting the property to 2. I didn't give any explanation about it at the time, but contrary to what it may intuitively appear, you don't set this property to the number of attachments (parts) you want to send alongside the message.If you attach 4 different parts to the message, you don't set the property to the value 4.

Instead, the value 2 means "Send all parts as attachments", which is exactly the behavior you want. For completeness sake, here's what each possible value for this property means (taken from the BizTalk documentation):

  • 0 - No BizTalk message parts will be used as attachments.
  • 1- The BizTalk message body part is sent as an e-mail attachment. In this case, the EmailBodyFile or EmailBodyText properties should be specified. If neither of these properties are specified, the BizTalk message body part is sent as the e-mail body instead of as an attachment.
  • 2 - All parts are sent as attachments. However, if EmailBodyText or EmailBodyFile are not specified, then the BizTalk message body part is sent as the e-mail body and other parts are sent as attachments.


  • Comments are closed.

    Syndicate

    About

    Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

    tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

    email: tomas@winterdom.com
    msn: tomasr@passport.com

    View my profile on LinkedIn

    MVP logo

    Ads


    Links

    Categories

    Statistics

    Total Posts: 1032
    This Year: 102
    This Month: 1
    This Week: 1
    Comments: 801

    Blogroll

    Archive

    Other

    Copyright © 2002-2008, Tomas Restrepo.

    Powered by: newtelligence dasBlog 2.1.8139.823

    Sign In