I am using EASendmail to send emails.The email body is a rich textbox.If i do formatting e.g. One line below another and send the email,the email loses it's formatting. For example if type this :
Hello,
How are you ?
in the rich text box and send it,then it becomes :
Hello,How are you
How do i maintain the text formatting ? And one more thing, if i add any image to my rich textbox, the email body doesn't keep the image ..I mean , the receiver only receives the texts of the email body, not the image. How to fix these issues ?
My code to send email is :
Dim oMail As New SmtpMail("TryIt")
Dim oSmtp As New EASendMail.SmtpClient()
oMail.From = fromtxt.Text
oMail.To = New AddressCollection(totxt.Text)
oMail.Subject = subjecttxt.Text
oMail.HtmlBody = bodytxt.Text
Dim oServer As New SmtpServer(MailConfig.host.Text)
oServer.Port = MailConfig.port.Text
oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
oServer.User = fromtxt.Text
oServer.Password = MailConfig.password.Text
oSmtp.SendMail(oServer, oMail)
EDIT
I even tried :
oMail.HtmlBody = "<html><body>" + bodytxt.Text + "</body></html>"
But no results
This is an easy fix . All i had to do is convert my RTF to HTML and then send it..RTF-TO-HTML-CONVERTER
After downloading the project files, reference must be added to the .dll files in the bin folder.Then :
Imports Itenso.Rtf.Converter.Html
Imports Itenso.Rtf.Support
Imports Itenso.Rtf
Dim rr As String = bodytxt.Rtf.Replace("\0", "")
Dim rtfDocument As IRtfDocument = RtfInterpreterTool.BuildDoc(rr)
Dim htmlConverter As New RtfHtmlConverter(rtfDocument)
Dim html1 As String = htmlConverter.Convert()
' my other codes in-between(read my post)
oMail.HtmlBody = html1