We help IT Professionals succeed at work.

email & hebrew

sasha85
sasha85 asked
on
i am tring to build a regular form in wich will be send to some email after submition...
but when i am typing hebrew inside the form and use this code, i got some '×>×' ×'×>×"×' gibberish
, i am not a big expert in hebrew but it sure not looks like it...
the page that set the form set as <meta http-equiv="content-type" Content="text/html;charset=utf-8">
and same as with the page that sends the emails...
<%


dim xdep,xmsg
xdep = request.form("ondep")
xmsg = request.form("onmsg")

if xmsg<>"" then

Set objEmail = Server.CreateObject("Persits.MailSender")

objEmail.Username = "emailname"
objEmail.Password = "pass"
objEmail.Host = "host"
objEmail.From = "frommail"
objEmail.AddAddress "to mail"

objEmail.Subject = "var1:" & xdep & "var2:" & xmsg

objEmail.body = "var1:" & xdep & "var2:" & xmsg

objEmail.Send

Set objEmail = Nothing

response.redirect "contactus.htm"

end if
%>


how can i build it inside html in order to pass it normaly?
Comment
Watch Question

If I understand you correctly the issue is with the emails that get sent with your code - they appear in gibberish.

Try using other email components (try Windows standard - CDONTS and similar) to see how they send the email. If you get the same results its an issue with your server (or with your code -- but what you pasted here looks fine). If you don't, Persits probably have a bug with UTF8 strings...

Stilgar.

Author

Commented:
but when i use:
strBodyPath = Server.MapPath("\folder") & "\mailbody.asp"
objEmail.AppendBodyFromFile strBodyPath

strImagePath = Server.MapPath("\folder\web") & "\welogo.jpg"
objEmail.AddEmbeddedImage strImagePath, "imgfl"

the page mailbody.asp
that is written in hebrew is sent ok...with nice hebrew...
the problem is that i don't know how to pass my variables into it...


mailbody.asp
<HTML>
<HEAD>
<STYLE>BODY {
COLOR: #427d64; FONT-FAMILY: "Arial"; FONT-SIZE: 12pt; MARGIN-LEFT: 8em
}
</STYLE>
</HEAD>
<BODY>
<CENTER>
<IMG SRC="cid:imgfl" BORDER=0></A>
</CENTER>
</BODY>
</HTML>

Commented:
Hi

It works on mine, then either it's the host configuration or there's a problem with the
Mailer.AddAddress "sherice@mascotartist.com"
Mailer.Host = "mail.mascotartist.com"
lines.

Author

Commented:
as in that code
strBodyPath = Server.MapPath("\folder") & "\mailbody.asp"
objEmail.AppendBodyFromFile strBodyPath

strImagePath = Server.MapPath("\folder\web") & "\welogo.jpg"
objEmail.AddEmbeddedImage strImagePath, "imgfl"


can i set a variable and view it with the icluded file?

something like:

strvar1path = xmsg
objEmail.AddEmbeddedImage strvar1path, "pvar1"

and use it inside the icluded file like
<=cid:pvar1> ?
Try this:

mailbody.asp
<HTML>
<HEAD>
<STYLE>BODY {
COLOR: #427d64; FONT-FAMILY: "Arial"; FONT-SIZE: 12pt; MARGIN-LEFT: 8em
}
</STYLE>
</HEAD>
<BODY>
%body%
<CENTER>
<IMG SRC="cid:imgfl" BORDER=0></A>
</CENTER>
</BODY>
</HTML>

And in your code:
strBodyPath = Server.MapPath("\folder") & "\mailbody.asp"
objEmail.AppendBodyFromFile strBodyPath
objEmail.body = Replace(objEmail.body, "%body%", request.form("somevar"))

If this still returns gibberish there is some configuration issues with the server. I've had similar issues in the past with Hebrew sites that were hosted on server which did not recognize it, mainly with DBs like MySQL and MsSQL. Could be that the issue you have is with IIS encoding misconfiguration.

Stilgar.
Also, check an option to load a page using URL, and then pass the variables as query string values.

Stilgar.

Commented:
It sounds like unicode, try setting these:

Check out this site, you may want to look at 'IsHTML', or 'Charset'.
http://www.ipower.be/en/manual/asp/ASPEmail.aspx

Author

Commented:
stilgar, i tried your code...that originaly what i wanted to do...but i get a mail with %body%
it just print the %body%...
is that the right syntax for displaying variables?

about the querystring...that was my first shot...it won't work...

Author

Commented:
there is no database involved...it just a form bing submited...
and when i sent it i get the subject in hebrew, the body in utf and the strBodyPath in hebrew too...
that's why i like stilgar's idea...but there is syntax problem with it...

Author

Commented:
even if there is problems with hebrew on the server...that not means that there is not a way doing this withembed inside html...the question is how to do this...

Author

Commented:
i aborted the ship...i tried IPWorks and jmail and they both good:)
what shell i choose than? what is better?
I like JMail better. Obviously Persists component wasn't configured well..

Stilgar.

Commented:
JMail

Author

Commented:
IPWorks is not persist component...is there any reason you like jmail batter?
is it involved secure reasons?
i heard that there are ways to read mails that send via those components....?

Author

Commented:
in jmail, why do i need to use objEmail.AddRecipient
if i am not using it gives me error

Author

Commented:
is there a way in jmail to include file like in aspemail?
strBodyPath = Server.MapPath("\folder") & "\mailbody.asp"
objEmail.AppendBodyFromFile strBodyPath

strImagePath = Server.MapPath("\folder\web") & "\welogo.jpg"
objEmail.AddEmbeddedImage strImagePath, "imgfl"
I honestly don't remember much of it. They have excellent documentation though.

http://www.dimac.net/Products/w3JMail/Manuals/w3_JMail.pdf

Stilgar.

Author

Commented:
great!:) thank u all

Explore More ContentExplore courses, solutions, and other research materials related to this topic.