Home All Groups Group Topic Archive Search About

SmtpClient/MailMessage Header Problem

Author
12 Dec 2006 4:33 PM
Tom John
Hi

I am trying to send an Xml string as the body of an email to interact
with a legacy system:

<code>
            Dim mail As New MailMessage
            Dim mailClient As New SmtpClient(MailServerIP)
            mailClient.UseDefaultCredentials = True
            mail.From = New MailAddress(SenderEmail, SenderName)
            mail.To.Add(New MailAddress(EnquiryEmail))
            mail.Body = GetXml.OuterXml
            mailClient.Send(mail)
</code>

The problem is that after the message is sent, the following headers
are added (amongst others):

<pre>content-type: text/plain; charset=us-ascii
content-transfer-encoding: quoted-printable</pre>

Thes headers are causing crlf characters to be insterted into the Xml,
invalidating it. I assume there is some way to configure the SmtpClient
to omit these headers, but I can't find where.

Anyone got any ideas?

Thanks

Tom

AddThis Social Bookmark Button