Click here to Skip to main content
15,901,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone.

i have been developed a small smtp Windows application in vb.net, .net 4 framework. ihave read the following article How to Send Mails from your GMAIL Account through VB.NET or C#. Windows Programming, with a Bit of Customization[^] and used snippets of codes to get the main funcationality of the program.

An issue i am stuck with and i have searched multple places on the net with no luck, is i am using a richtextbox for the main message text box (txtmessge) but when i send the message in HTML view, it doesnt retain the formatting properties, is it achievable to have a message sent as it formatted in the richtextbox.

i believe this is where the issue alies in the code:

VB
     Dim htmlview As String
     Dim messagebyuser As String = txtmessage.Text
     Dim locateS As String = "C:\logo.jpg"
htmlview = messagebyuser


or will i have to build the message into a html structure?

any help would be appericated. =)
Posted

Hi
If the rich textbox contain strings in html format then you have to set the property of MailMessage

IsBodyHtml to true. If need to use styles, use inline style in the heml text
 
Share this answer
 
Also be aware that outlook 2007 onwards has changed the ways that it reads HTML emails.

you will need to embed images rather than add them as HTML tag. Also they have changed the way that it reads StyleSheets.

microsoft breaks html email rendering in outlook[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900