发送后电子邮件未保持格式 VB.NET
Email doesn't maintain formatting after sending VB.NET
我正在使用 EASendmail 发送 emails.The 电子邮件正文内容丰富 textbox.If 我会进行格式化,例如一行低于另一行并发送电子邮件,电子邮件会丢失其格式。例如,如果输入:
Hello,
How are you ?
在富文本框中发送,则变成:
Hello,How are you
如何维护文本格式?还有一件事,如果我将任何图像添加到我的富文本框,电子邮件正文不会保留图像..我的意思是,收件人只收到电子邮件正文的文本,而不是图像。如何解决这些问题?
我发送电子邮件的代码是:
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)
编辑
我什至试过了:
oMail.HtmlBody = "<html><body>" + bodytxt.Text + "</body></html>"
但是没有结果
这是一个简单的修复。
我所要做的就是将我的 RTF 转换为 HTML 然后发送它..RTF-TO-HTML-CONVERTER
下载项目文件后,必须在bin中添加.dll文件的引用folder.Then :
Imports Itenso.Rtf.Converter.Html
Imports Itenso.Rtf.Support
Imports Itenso.Rtf
Dim rr As String = bodytxt.Rtf.Replace("[=10=]", "")
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
我正在使用 EASendmail 发送 emails.The 电子邮件正文内容丰富 textbox.If 我会进行格式化,例如一行低于另一行并发送电子邮件,电子邮件会丢失其格式。例如,如果输入:
Hello,
How are you ?
在富文本框中发送,则变成:
Hello,How are you
如何维护文本格式?还有一件事,如果我将任何图像添加到我的富文本框,电子邮件正文不会保留图像..我的意思是,收件人只收到电子邮件正文的文本,而不是图像。如何解决这些问题?
我发送电子邮件的代码是:
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)
编辑
我什至试过了:
oMail.HtmlBody = "<html><body>" + bodytxt.Text + "</body></html>"
但是没有结果
这是一个简单的修复。 我所要做的就是将我的 RTF 转换为 HTML 然后发送它..RTF-TO-HTML-CONVERTER
下载项目文件后,必须在bin中添加.dll文件的引用folder.Then :
Imports Itenso.Rtf.Converter.Html
Imports Itenso.Rtf.Support
Imports Itenso.Rtf
Dim rr As String = bodytxt.Rtf.Replace("[=10=]", "")
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