BizTalk Server General - SMTP Content-Type

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > May 2004 > SMTP Content-Type





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author SMTP Content-Type
Michael

2004-05-24, 11:35 pm

I need to set the content-type on the messages going out from the SMTP adapter to HTML. Can't seem to find any properties to do this. Is there a registry hack or a workaround to acheive this?

Martin Marinov

2004-05-25, 7:37 am


"Michael" <anonymous@discussions.microsoft.com> wrote in message
news:22A787CC-F9A9-4005-8A1A-54EFC2763495@microsoft.com...
> I need to set the content-type on the messages going out from the SMTP

adapter to HTML. Can't seem to find any properties to do this. Is there a
registry hack or a workaround to acheive this?
>


"Michael" <anonymous@discussions.microsoft.com> wrote in message
news:<22A787CC-F9A9-4005-8A1A-54EFC2763495@microsoft.com>...

> I need to set the content-type on the messages going out from the SMTP

adapter to HTML. Can't seem to find any properties to do this. Is there a
registry hack or a workaround to acheive this?

>


You can do it programatically

Check the BizTalk help : Sending an HTML-Formatted E-Mail Message from an
Orchestration

http://msdn.microsoft.com/library/d..._email_syyd.asp

Also you can check if the HTTP.ContentType as a parameter of the messega if
will resolve the solution


Allen Zhang

2004-05-30, 10:46 am

The link Martin sent shows that you can set the contentType on each of
message part. That information will be used by SMTP adapter when MIME
encoder is not used.

The HTTP.ContentType is used by HTTP adapter, it does not apply here.

Thanks!

- Allen Zhang (MSFT)

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------[vbcol=seagreen]
biz_prog_email_syyd.asp[vbcol=seagreen]
if[vbcol=seagreen]

Michael

2004-05-30, 10:46 am

Thanks for your response. Any idea of where I'm going wrong?

Basically I've set up a simple orchestration with an xml receive, transform(to construct a message), expression shape, then send to a dynamic port

The expression shape has the following code

// OutMessage is RawString as downloaded and compiled from msdn
OutMessage = new Microsoft.Samples.BizTalk.XlangCustomFormatters.RawString("<HTML><BODY>Your expensereport with reference</BODY></HTML>");

// Set the content type
SMTPUtils.Part.SetContentType(Message_2.MessagePart_1, "text/html");

// Port_2 is the dynamic port
Port_2(Microsoft.XLANGs.BaseTypes.Address) = "mailto:Michael@qwe.com";

// Message_2 is the message sent to Port_2
Message_2(SMTP.Subject) = "Expense report submission confirmation";

Qu1:: When I compile I get an error on the last line setting the subject saying "Message_2 must be constructed within a construct block". Even though it is constructed via the previous transform shape. What am I doing wrong?

Qu2:: OutMessage is an orchestration variable of type "Microsoft.Samples.BizTalk.XlangCustomFormatters.RawString". How do I assign this RawString to the Message_2?

Qu3:: To see if I could get an email with the content-type set to html I tried commenting the first and last lines in the expression shape out so the expression was only setting the contenttype and email address on the port. This compiles fine, but when
I run it I get the following error. "Illegal attempt to update the value of XLANG/s message 'part' after the message construction was complete.". So I moved the expression before the transform which of course gives me a compile error saying "use of una
ssigned local variable 'Message_2.MessagePart_1". At what point exactly shoulde I be setting the content-type on the parts of Message_2?

Many thanks for any help.
Martin Marinov

2004-05-30, 10:46 am

Qu1. Have you set in the constructMessage -> Property window ->Messages
Constructed - Message_2 ?
Qu2. You have to create a Multi-part Message Type and then Message_2 must be
assigned to this multi-part message type
in the Message_2 you have to create two message parts :
1. OutMessage of type
Microsoft.Samples.BizTalk.XlangCustomFormatters.RawString
2. MessagePart_1 of type, the type of message that was transformed ( for
example MessagePart_NormalMessage )

Message_2.MessagePart_NormalMessage=the message that was transformed;

Message_2.MessagePart_1= new
Microsoft.Samples.BizTalk.XlangCustomFormatters.RawString("<HTML><BODY>Your
expensereport with reference</BODY></HTML>");
SMTPUtils.Part.SetContentType(Message_2.MessagePart_1,"text/html");
Port_2(Microsoft.XLANGs.BaseTypes.Address) = "mailto:Michael@qwe.com";
Message(SMTP.Subject) = "Expense report submission confirmation";

Regards
Martin Marinov

"Michael" <anonymous@discussions.microsoft.com> wrote in message
news:AF26E177-F82C-457D-B288-CA10CD55496E@microsoft.com...
> Thanks for your response. Any idea of where I'm going wrong?
>
> Basically I've set up a simple orchestration with an xml receive,

transform(to construct a message), expression shape, then send to a dynamic
port
>
> The expression shape has the following code
>
> // OutMessage is RawString as downloaded and compiled from msdn
> OutMessage = new

Microsoft.Samples.BizTalk.XlangCustomFormatters.RawString("<HTML><BODY>Your
expensereport with reference</BODY></HTML>");
>
> // Set the content type
> SMTPUtils.Part.SetContentType(Message_2.MessagePart_1, "text/html");
>
> // Port_2 is the dynamic port
> Port_2(Microsoft.XLANGs.BaseTypes.Address) = "mailto:Michael@qwe.com";
>
> // Message_2 is the message sent to Port_2
> Message_2(SMTP.Subject) = "Expense report submission confirmation";
>
> Qu1:: When I compile I get an error on the last line setting the subject

saying "Message_2 must be constructed within a construct block". Even
though it is constructed via the previous transform shape. What am I doing
wrong?
>
> Qu2:: OutMessage is an orchestration variable of type

"Microsoft.Samples.BizTalk.XlangCustomFormatters.RawString". How do I
assign this RawString to the Message_2?
>
> Qu3:: To see if I could get an email with the content-type set to html I

tried commenting the first and last lines in the expression shape out so the
expression was only setting the contenttype and email address on the port.
This compiles fine, but when I run it I get the following error. "Illegal
attempt to update the value of XLANG/s message 'part' after the message
construction was complete.". So I moved the expression before the transform
which of course gives me a compile error saying "use of unassigned local
variable 'Message_2.MessagePart_1". At what point exactly shoulde I be
setting the content-type on the parts of Message_2?
>
> Many thanks for any help.



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com