Problem sending HTML Jmail email with hebrew content

i'm building a simple newsletter system for a client using asp, access and Jmail. the user enters text and uploads images. everything is in hebrew and i'm using utf-8 encoding.

i encounter problems when i try and send the template page with the relevant dynamic data as a HTML email... all the hebrew text comes out as screwed up characters (המשכן as an example... of course i have to presume you'll see the same as me here: gobbledigook).

below is a snippet of the code i'm using ... the line which defines the content of the mail is

msgTemplate.GetMessageBodyFromURL ""&varID

this page displays correctly if viewed with the browser, but when mailed it scrambles the text.

here is the code :

 set msgTemplate = Server.CreateObject( "JMail.Message" )
 msgTemplate.From = ""
 msgTemplate.FromName = "Bob."
msgTemplate.AddRecipient "%%email%%"
msgTemplate.Subject = Request.Cookies("subject")

msgTemplate.ContentType = "text/html; charset=UTF-8"
'msgTemplate.ContentTransferEncoding = "65001"
'msgTemplate.ContentType = "text/html"
msgTemplate.Charset = "utf-8"

msgTemplate.GetMessageBodyFromURL ""&varID

set mMerge = Server.CreateObject( "JMail.MailMerge" )
mMerge.MailTemplate = msgTemplate

msgTemplate.MailServerUserName = ""
msgTemplate.MailServerPassword = "bob"
msgTemplate.Silent = True
   msgTemplate.Logging = True
 mMerge.BulkMerge  rs, false, ""
Response.Write("<br><br>mail sent")

any suggestions ?


Who is Participating?
kelvinwkwConnect With a Mentor Commented:
use server.htmlencode()
dog_starAuthor Commented:
thanks for the reply... not sure if i've applied your suggestion correctly but i tried this :

varURL =   ""&varID
varURL =  server.htmlencode(varURL)
msgTemplate.GetMessageBodyFromURL varURL

and get the same results as before (ie strange characters in the mail)...
dog_starAuthor Commented:
ah right, found what you meant... use the server.htmlencode on the template page to encode the dynamic data.... silly i didn't get what you meant...

encoding the data works perfect... many thanks....
dog_starAuthor Commented:
ok, it was close to perfect..... now all the hebrew dynamic text displays correctly, but the static text is still garbled.... i've tried putting the static text like this but it yields the same results :

<%=Server.HTMLEncode(Response.Write("hebrew text here"))%>

any suggestions for getting the rest to display correctly?

or should i post this as a new question....


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.