Send Email with Multiple attachments using BizTalk SMTP

Ravi Ranjan 21 Reputation points
2021-02-03T10:13:02.13+00:00

Hello,

I need to send multiple attachments (1... n) using BizTalk SMTP adapter. I have created a Multipart message with one body and dynamically adding parts to the multipart message using .Net Helper assembly.

I added one construct shape before the loop and one after inside loop, but my multipart message is always added with latest message part during runtime. It seems my parts are getting overridden with the new one and at last the last part is sent as attachment.

I have referred an old article: https://social.msdn.microsoft.com/Forums/en-US/d3191ca7-c07e-4bb3-84b6-d5416536beef/constructing-multipart-message?forum=biztalkgeneral.

As suggested, I have also created one XLangMessage variable and assigned to the message inside the loop, but I am getting an "Use of unassigned local variable var_XLANG".

Could you all please guide me how to initialize the variable or any new ideas for sending the attachments.

Thanks in advance.

Regards

Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
364 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leo Erlandsson 1,656 Reputation points
    2021-02-03T15:48:26.03+00:00

    Hi,

    We are doing this. Basically, we selected to do the attachment of multiple files in C# Code instead. It's certainly possible to do this in an Orchestration Loop, it's just easier and more performant in Code.

    Please see attached screenshot of Orchestration (don't mind the loop that's for other functionality), Message Construct and snipped of C# code.

    Br,
    Leo
    63564-2021-02-03-16-46-58-p-malmo-biztalk2016-ny-dev-v2.png
    63565-2021-02-03-16-46-19-p-malmo-biztalk2016-ny-dev-v2.png
    63573-2021-02-03-16-45-38-p-malmo-biztalk2016-ny-dev-v2.png


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.