ASP.Net Sending Mail Via EWS Removes line breaks in body

Hi

I have a textbox on a page which I use as the body of an e-mail I’m trying to send out.  The e-mail works fine, but the body is 1 long sting whereas before it was on several lines e.g.

Line1
Line2
Line3
On e-mail looks like
Line1Line2Line3

My code is below

Any one any ideas??

Thanks  

Brasso

'Text Box Im suning as body'
    <asp:TextBox ID="TXTMB" runat="server" Height="175px" TextMode="MultiLine" 
        Width="600px"></asp:TextBox>

'VB To Send Mail'

        Try

            Dim service As New ExchangeService(ExchangeVersion.Exchange2007_SP1)
            service.Credentials = New WebCredentials("####", "####", "####")
            service.AutodiscoverUrl("######")

            Dim message As New EmailMessage(service)
            message.Subject = txtsubject.Text
            message.Body = TXTMB.Text
            message.ToRecipients.Add(txtto.Text)
            message.CcRecipients.Add(txtcc.Text)
            message.SendAndSaveCopy()


            ' ' Write confirmation message to console window.
            txtSavRes.Text = ("Message sent!")

        Catch ex As Exception
            txtSavRes.Text = ("Error: " & ex.Message)

        End Try

Open in new window

LVL 1
brasso_42Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alfred A.Commented:
Hi,

Is your mail message body set as html?  If it is you have to replace all new lines with <br />

message.Body = TXTMB.Text.Replace(Environment.NewLine,"<br />")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brasso_42Author Commented:
great thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.