Click here to Skip to main content
15,886,617 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more: , +
Hi,

I've a segment of code which combines the HTML signature from Outlook into an email settings (Code below).

However, when the string contains accentuated characters (ie, é), the emails sent through the .NET Mail objects replace them with the "?" character. Is there anyway to retain the accentuated characters, or at least convert them to their unaccentuated equilavent?

Cheers

<br />
    If Not mailMsg.IsBodyHtml Then<br />
      htmlMailComposed = "<body>" & Replace(Replace(Replace(Replace(Replace(mailMsg.Body, "<", "<"), ">", ">"), vbCrLf, "<br>"), vbCr, "<br>"), vbLf, "<br>") & htmlMailOutput & "</body>"<br />
      mailMsg.IsBodyHtml = True<br />
      mailMsg.Body = htmlMailComposed<br />
    Else<br />
      mailMsg.Body = Replace(mailMsg.Body, "</body>", htmlMailOutput & "</body>", , , CompareMethod.Text)<br />
    End If<br />
</br></br></br>
Posted

1 solution

Try changing the BodyEncoding[^] property.
 
Share this answer
 
Comments
MarqW 27-Mar-11 8:38am    
Facepalm! Thank you! Can't believe I missed that
Wendelius 27-Mar-11 10:37am    
No problem :)
Dalek Dave 27-Mar-11 10:33am    
Good Catch, 5.
Wendelius 27-Mar-11 10:37am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900