Note that there are some explanatory texts on larger screens.

plurals
  1. POSending html mail displays correctly on some applications but not on others?
    primarykey
    data
    text
    <p>I am sending emails via a VB application. The following characters displays correctly on some email applications but on others, I get a weird replacement (See attached image). How can I go about making these characters always display correctly?</p> <p>The character set : ( ) &amp; * % $ # @ ! ~ ; _ = + / - ? </p> <p>The Message : 18cm – 22cm Wide; Fat O</p> <p>The result : <img src="https://i.stack.imgur.com/qkvim.jpg" alt="enter image description here"></p> <p>No matter which one of the characters gets used, The result is always the same as the attached image. The applications that does not display correctly is outlook &lt; 2013.</p> <p>Here is the VB code:</p> <pre><code>Sub subHtmlEmail(ByVal strAddresseeEmail As String, ByVal strGroup As String) Try Dim strTo, strFrom, strBody, strSubject, strBcc As String Dim boolHtml As Boolean = True ' set the body content to plain text(false) or HTML(true) strFrom = "sales@humeat.com" strTo = strAddresseeEmail ' ; Separates emails strBcc = "" ' ; Separates emails strSubject = txtEmailSubject.Text strBody = "&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;" strBody = strBody &amp; "&lt;img src=cid:Logo&gt;" strBody &amp;= "&lt;br&gt;&lt;br&gt;" strBody &amp;= "Dear " &amp; clsGroupCustomers.RetrieveAddressee(strAddresseeEmail, strGroup) &amp; ",&lt;br&gt;&lt;br&gt;" Dim strLines As String() = txtBody.Text.Split(New [Char]() {CChar(vbCrLf)}) For Each strLine As String In strLines strBody &amp;= strLine &amp; "&lt;br&gt;" Next strBody &amp;= "&lt;br&gt;&lt;br&gt;" Dim strFooterLines As String() = txtFooter.Text.Split(New [Char]() {CChar(vbCrLf)}) For Each strFooterLine As String In strFooterLines strBody &amp;= strFooterLine &amp; "&lt;br&gt;" Next HTMLView = AlternateView.CreateAlternateViewFromString(strBody, Nothing, "text/html") strBody &amp;= "&lt;/body&gt;&lt;/html&gt;" subEmail(strFrom, strTo, strBcc, strSubject, strBody, boolHtml, strAddresseeEmail) 'subEmail(strFrom, strTo, strBcc, strSubject, System.Web.HttpUtility.HtmlEncode(strBody), boolHtml, strAddresseeEmail) Catch ex As Exception Cursor = Cursors.Default MsgBox("An error has occurred in your application while attempting to create the email." &amp; Chr(13) &amp; Chr(13) &amp; "Description: " &amp; ex.Message &amp; Chr(13) &amp; Chr(13) &amp; "Please contact your System Administrator.", MsgBoxStyle.Critical, "Application Error") Exit Sub End Try End Sub 'Send the email Sub subEmail(ByVal strFrom, ByVal strTo, ByVal strBcc, ByVal strSubject, ByVal strBody, ByVal bolHtml, ByVal strAddresseeEmail) Try 'Dim strMailServer As String = "smtp.dsl.telkomsa.net" Dim strMailServer As String = "smtp.insightsa.net" 'Dim strMailServer As String = "smtp.humeat.com" 'Dim strMailServer As String = "mail.humeat.com" Dim intCount As Integer Dim objAttachment As Attachment Dim objMail As New MailMessage() objMail.From = New MailAddress(strFrom) Dim i As Integer Dim arrArray As Array arrArray = Split(strTo, ";") For i = 0 To arrArray.Length - 1 objMail.To.Add(arrArray(i)) Next arrArray = Split(strBcc, ";") For i = 0 To arrArray.Length - 1 If Not arrArray(i) = "" Then objMail.Bcc.Add(arrArray(i)) Next For intCount = 0 To lstAttachments.Items.Count - 1 objAttachment = New Attachment(lstAttachments.Items(intCount).ToString) objMail.Attachments.Add(objAttachment) Next ' [TW 20110309] ' Create the LinkedResource (embedded image) Dim logo As New LinkedResource("C:\humeat.bmp") logo.ContentId = "Logo" ' [TW 20110309] ' Add the LinkedResource to the appropriate view HTMLView.LinkedResources.Add(logo) ' [TW 20110309] ' Add the views objMail.AlternateViews.Add(PlainView) objMail.AlternateViews.Add(HTMLView) objMail.Subject = strSubject objMail.Body = strBody objMail.IsBodyHtml = bolHtml Dim smtp As New SmtpClient(strMailServer) smtp.Port = "587" ' This is not the default port of 25 but a special smtp port because they use Mweb. HC. 2-8-2011 smtp.Credentials = New System.Net.NetworkCredential("humeat@insightsa.net", "123Four56") smtp.Send(objMail) Catch ex As Exception Cursor = Cursors.Default 'MsgBox("An error has occurred in your application while attempting to send the email to " &amp; strTo &amp; "." &amp; Chr(13) &amp; Chr(13) &amp; "Description: " &amp; ex.Message &amp; Chr(13) &amp; Chr(13) &amp; "Please contact your System Administrator.", MsgBoxStyle.Critical, "Application Error") lstEmailsNotSent.Items.Add(clsGroupCustomers.RetrieveAddressee(strAddresseeEmail, cboEmailGroup.Text) &amp; " (" &amp; strTo &amp; ") - " &amp; ex.Message) Exit Sub End Try End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload