Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

How to sent txt and html from richtextboxes

Hi!

Have this code:

Dim myMessage As System.Web.Mail.MailMessage
            myMessage = New System.Web.Mail.MailMessage
            myMessage.To = til
            myMessage.From = txtFrom.Text
            myMessage.Subject = txtSubject.Text
            myMessage.Body = Me.header.Text & Chr(10) & Chr(10) & body2.Text



 myMessage.Body = Me.header.Text & Chr(10) & Chr(10) & body2.Text
 Send from 2 richtextboxes, where the 1 textbox is NOT HTML
But the other is HTML

My problem is that i cant get linebreaks from the first richtextbox ?

How can i solve this ?
0
team2005
Asked:
team2005
1 Solution
 
s_chilkuryCommented:
Try this alternative...

Read each line in the first RTB (RichTextBox) ...

and put a .Text +  Environment.NewLine and store in the String Builder for each line ...

Then use this StringBuilder.ToString()
0
 
Imran Javed ZiaCommented:
Hi,
Please try one of following:

myMessage.Body = Me.Header.Text & "<br />" & body2.Text
or
myMessage.Body = Me.Header.Text & Environment.NewLine & body2.Text

Thanks
0
 
team2005Author Commented:
Hi!

IJZ -> dosent work

s_chilkury -> can you please give me example of what you meen.
Thanks
0
 
CodeCruiserCommented:
Have you set the

MyMessage.IsBodyHTML = True?
0
 
team2005Author Commented:
thanks
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now