简体   繁体   中英

Send Email body with Rich text box?

I need any code which can Help me to send Richtextbox content with the full formatting. I use this code:

    Dim sendera As String = My.Settings.Sendermail
    Dim pass As String = My.Settings.Password
    Dim smtpServer As New SmtpClient()
    Dim mail As New MailMessage()
    smtpServer.Credentials = New Net.NetworkCredential(sendera, pass)
    smtpServer.Port = My.Settings.Port
    smtpServer.Host = My.Settings.SMTP
    smtpServer.EnableSsl = My.Settings.ESSL
    mail = New MailMessage()
    mail.From = New MailAddress(sendera)
    mail.To.Add(TextBox1.Text)
    mail.Subject = TextBox2.Text
    mail.IsBodyHtml = True
    mail.Body = RichTextBox1.Text
    smtpServer.Send(mail)

but when I sen E-Mail it's show as Plain text without any formatting??

mailbody.Text.Replace(" ", "%20").Replace(vbNewLine, "%0A")
' %20 is url encoding for a space, %0A url encoding for new line

try this:
http://www.w3schools.com/tags/ref_urlencode.asp
good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM