2017-11-20 4 views
1

EASendmail을 사용하여 전자 메일을 보내고 있습니다. 전자 메일 본문은 서식있는 텍스트 상자입니다. 다른 한 줄 아래에 한 줄을 이메일로 보내면 이메일의 형식이 없어집니다. 예를 들어이 입력하는 경우 : 그것을 서식있는 텍스트 상자에VB.NET을 보낸 후 전자 메일의 서식이 유지되지 않습니다.

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>" 

그러나 결과가 없습니다

+0

본문이 포함 된 전자 메일을 HTML로 보내 보셨습니까? – DiscipleMichael

+0

RichText는 HTML과 다릅니다. 어떻게 든 변환해야합니다. 이미지 삽입 방법을 잘 모르겠습니다. 결코 시도하지 않았습니다. – dwilliss

+0

@DiscipleMichael,'oMail.HtmlBody = bodytxt.Text' .. 리치 텍스트 상자를 html로 보내지 않습니까? –

답변

1

이 쉬운 수정 프로그램입니다.

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 
: 내가 보내 다음 HTML로 내 RTF로 변환하고해야 할 일을했을 모든 .. RTF-TO-HTML-CONVERTER

는 프로젝트 파일을 다운로드 한 후, 참조는 빈 folder.Then에서 .dll 파일에 추가해야합니다

관련 문제