简体   繁体   中英

Using Tiny MCE, but emails are not sending formatted?

I am using tiny mce in a text box and trying to send emails.

    <asp:TextBox ID="txtBody" runat="server" Rows="10" class="tinymce"
                                TextMode="MultiLine" Width="100%"></asp:TextBox>

but the email which is sent is not formatted..

<p><span style="background-color: #ff0000;">hello</span></p >

it shouldnt say all that? just hello with a red background?

   Sub SendEmail(ByVal sEmailAddressFrom As String, ByVal sEmailAddressTo As String, ByVal sSubject As String, ByVal sBody As String)
    Dim msg As New MailMessage
    msg.To = sEmailAddressTo
    msg.From = sEmailAddressFrom
    msg.Body = sBody
    msg.Subject = sSubject
    Mail.SmtpMail.SmtpServer = "127.0.0.1"
    SmtpMail.Send(msg)
End Sub

ok, as I suspected....

Add the following to your code, and it should work...

Sub SendEmail(ByVal sEmailAddressFrom As String, ByVal sEmailAddressTo As String, ByVal sSubject As String, ByVal sBody As String)
    Dim msg As New MailMessage
    msg.To = sEmailAddressTo
    msg.From = sEmailAddressFrom
    msg.Body = sBody
    msg.IsBodyHtml = True 'New Line here
    msg.Subject = sSubject
    Mail.SmtpMail.SmtpServer = "127.0.0.1"
    SmtpMail.Send(msg)
End Sub

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