Send email containing multilingual text

I have this piece of code in an .asp file. I generate E-mail subject/body through XML tags and I send an email through ASP.
When I get the tags from XML it has different English/greek/french/german characters. Problem is I need to send mail in different languages at same time. After sending emails, sometimes few characters appear in the email as ????? or !!!!! or very confused characters.

Can anyone say exact reason why this is happening?
<meta http-equiv='Content-type' content='text/html;charset=UTF-8'>
 
Set myMail=CreateObject("CDO.Message")
myMail.Subject="my subject"
myMail.From=Request("email")
myMail.To="myemail@mail.com"
Dim Body
Body = Body & "Name: " & Request("name") & VbCrLf
Body = Body & "E-mail: " & Request("email") & VbCrLf
Body = Body & "-----" & VbCrLf
Body = Body & Request("the_message") & VbCrLf
 
myMail.TextBody=Body
 
myMail.Send
set myMail=nothing

Open in new window

LVL 5
sivachirravuriTeam Lead Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne BarronAuthor, Web DeveloperCommented:
Add this to your code

myMail.BodyPart.Charset = "utf-8"
myMail.TextBodyPart.Charset = "utf-8"
myMail.HTMLBodyPart.Charset = "utf-8"

Good Luck
Carrzkiss
0
sivachirravuriTeam Lead Author Commented:
Following is there from before
myMail.BodyPart.Charset = "utf-8"

I am getting following error "The requested body part was not found in this message" after I include
myMail.TextBodyPart.Charset = "utf-8"
myMail.HTMLBodyPart.Charset = "utf-8"


0
sivachirravuriTeam Lead Author Commented:
Thanks for you Reply.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Wayne BarronAuthor, Web DeveloperCommented:
did you try it without adding in these
myMail.TextBodyPart.Charset = "utf-8"
myMail.HTMLBodyPart.Charset = "utf-8"
??

Carrzkiss
0
Wayne BarronAuthor, Web DeveloperCommented:
Got it I think??

The reason for the error, is that it had to find the Body, and depending on where
The lines where located at, it could not find the body.
So setting in your case, the TextBodyPart
Below your   TextBody
Will allow it to see the body.

You are using HTMLBody
So you do not need to use the HTMLBodyPart
In this code issue.

Hope that helps?
Carrzkiss
<meta http-equiv='Content-type' content='text/html;charset=UTF-8'>
 
Set myMail=CreateObject("CDO.Message")
myMail.Subject="my subject"
myMail.From=Request("email")
myMail.To="myemail@mail.com"
Dim Body
Body = Body & "Name: " & Request("name") & VbCrLf
Body = Body & "E-mail: " & Request("email") & VbCrLf
Body = Body & "-----" & VbCrLf
Body = Body & Request("the_message") & VbCrLf
myMail.BodyPart.Charset = "utf-8"  
myMail.TextBody=Body
myMail.TextBodyPart.Charset = "utf-8" 
'myMail.HTMLBodyPart.Charset = "utf-8" ' Use this if you have HTMLBody
myMail.Send
set myMail=nothing

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sivachirravuriTeam Lead Author Commented:
Above solution help to some extent but still sometime email body is including an "!" and space when the body is bigger (around 750+ characters). The issue is occuring both in .textbody and .htmlbody formats.
e.g. 'poin! ts' instead of 'points'
0
sivachirravuriTeam Lead Author Commented:
I observered that it may be problem because of length. When I remove few words in the mail, this "! " moves backward that many characters.
it's very wierd. I don't understand what is problem with length? Any suggession please.
0
Wayne BarronAuthor, Web DeveloperCommented:
I really have no idea what would be causing this issue.
I have checked to see if I can find a restriction or length issue with the charset
And I am not find nothing on it.

I will see if I can find some more info later on today or tomorrow when I have the spare time.

Carrzkiss
0
sivachirravuriTeam Lead Author Commented:
Thanks a ton for the solution. Problem is solved by giving Charset to TextBodyPart & HTMLBodypart, just before send & some other part of code.
0
Wayne BarronAuthor, Web DeveloperCommented:
Cool, so adding it in to just the right place made it all work out.
That is awesome.

Glad that you have it working now.
Keep up the great coding.

Carrzkiss

Author Comments:
Thanks a ton for the solution. Problem is solved by giving Charset to TextBodyPart & HTMLBodypart, just before send & some other part of code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.