Message Body Part Attachment SMTP Adapter Dynamic Port Configuration

Tuesday, August 9, 2011

Q:
Hi,
I have few files to that are generated by biztalk to be sent in email. So i have a multipart message to and I sent the body part of the message to a rawstring (giving a success message string) and then attach the biztalk generated message to the other parts of the multi part message and send this message through the smtp adapter (using dynamic port)


here is the code
============

EmailMessage.Body = new RawString("successful generation.");

EmailMessage.attachmentOne = msgAttachmentOne;

EmailMessage.attachmentTwo = msgAttachmentTwo;


EmailMessage(SMTP.Subject) = "<subject>"

EmailMessage(SMTP.From) = <from email>

EmailMessage(SMTP.SMTPHost) = <smtp server>

EmailMessage(SMTP.SMTPAuthenticate) = 2

EmailMessage(SMTP.MessagePartsAttachments) = 2
=======
But i receive EmailMessage.attachmentTwo as my email body and other 2 parts as attachments.

Also I have made "EmailMessage.Body" as the body part in the multi part message type (Message Body Part = true)

How do I correct this ? any ideas
PLEASE HELP thanks in advance

Ans:
Hi Surya,
Try this configurations:

EmailMessage.Body = new RawString("successful generation.");

EmailMessage.Body =(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";

//copy the expense report into the multiple-part message

//set the content type and the filename for the attachment

EmailMessage.attachmentOne = msgAttachmentOne;

EmailMessage.attachmentTwo = msgAttachmentTwo;


//you can also give names to the attach files

EmailMessage.attachmentOne(MIME.FileName) = "attach1.xml";

EmailMessage.attachmentTwo(MIME.FileName) = "attach1.xml";

//configuration option to specify how BizTalk message parts should be attached to

//outgoing email message

EmailMessage(SMTP.MessagePartsAttachments) = 2;

//set up topic

EmailMessage(SMTP.Subject) = "subject";

EmailMessage(SMTP.EmailBodyFileCharset) = "UTF-8";

EmailMessage(SMTP.From) = "from";

EmailMessage(SMTP.SMTPHost) = "smtp host";

EmailMessage(SMTP.SMTPAuthenticate) = 2;


In multi-part message properties you need to configure:
Body as "Message Body Part" to True
attachmentOne as "Message Body Part" to False
attachmentTwo as "Message Body Part" to False


What kind of pipeline are you using in the dynamic send port?


Its is happenning because of SMTP.MessagePartsAttachments property. Below is the explanation as how the attachments are decided.

MessageOut(SMTP.MessagePartsAttachments) = n

// Where n can be one of three values

0 (same as not set) - Do not attach any biztalk message parts. This is a default setting.

1 - Attach only biztalk body part

2 - Attach all parts

You should refer below post for more information.

http://stackoverflow.com/questions/2187750/send-html-email-in-biztalk-with-multiple-pdf-attachments-with-smtp-adapter




No comments:

Post a Comment

Post Your Comment...