Jump to content

How to send email in PHP using arabic language


searchacar

Recommended Posts

Hi,

I been creating and sending emails from a ling time by the coding form given below,

$to = $user_email;

// subject

$subject = 'helo';

 

// message

$message = "

<html>

<head>

<title> Account Activation Link</title>

</head>

<body>

<table width='759'>

<tr>

<td>message here</td>

</tr>

</table>

</body>

</html>

";

 

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

 

..................................

..................................

 

The above method is fine for sending emails in html and in english.

 

But if i use same code to generate arabic word it give some charcters like this,

 

"

ان كانت الÙتاة التي معك اختك او زوجتك او اØ*د من اقاربك Ùلا تÙكر مرة اخرى ان تأتي بها الى هذا المكان ولا ÙÙŠ المطاعم الاخرى المنتشرة ÙÙŠ المنطقة الخضراء وما شاهدته هنا لا يساوÙ

"

 

I have changed charset many time to arabic but could not reslove the issue and still get the same result.

 

Note: I first do query some result from database, get the result and then send it using the above email forms. thanks

 

any advice will be great.

Link to comment
Share on other sites

Hopefully, you're not sending messages to some terrorist organization... ;);D

 

What is the default character encoding on the server? And I could be wrong but, I believe that the character encoding on the receiving end also plays a part on whether it will be displayed properly.

Link to comment
Share on other sites

I dont know about servers, but it gets fine in hotmail. probably there character encoding automatically get set. However problem seen in yahoo, and outlook express.  It shows the message as i have posted the result above. I dont know how it comes ok in hotmail.

 

I also noticed that if i copy and paste the whole arabic words then it goes to yahoo fine. But getting error when i directly get result from datbases and then send in email.

 

 

Link to comment
Share on other sites

CHARSET=latin1 set in databases.

Also this works fine on the websites. all pages on website works ok, but problem is in sending email.

 

Note: If i do query from database and echo the result on website page which shows ok but when submit this information in email then it shows characters as shown on top.

However in outlook express it only works when we chages encoding.

 

hope this will help to understand the issue.

Link to comment
Share on other sites

can someone explain this bit, i think i am missing somthing here,

"

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";

 

"

 

if i use charset=utf-8 on web page it shows arabic fine either i open web page in internet explores, or firfox etc but why not in emails when i put charset=utf-8 in above header and send email using same databases it shows the result in yahoo and outlook express as given below,

 

"

ان كانت الÙتاة التي معك اختك او زوجتك او اØ*د من اقاربك Ùلا تÙكر مرة اخرى ان تأتي بها الى هذا المكان ولا ÙÙŠ المطاعم الاخرى المنتشرة ÙÙŠ المنطقة الخضراء وما شاهدته هنا لا يساوÙ

"

 

Is there something in browser over-riding. Or Is there I am missing any of field in header.

What usually people use in header to support other languages. any suggestion, i am realy stuck. thanks

 

 

Link to comment
Share on other sites

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

 

It seems to me no reply from any senior members.

 

If someone have knowledge of it can he/she explain this bit, i am realy stuck from few days.

 

if i change charset in above line to utf-8 and then send email then it makes no changes and email shown always in strange characters like this "§Ù† كانت " whatever i change the charset on top two header line it makes no effect on emails.

 

But why if i change charset in the browser then it makes changes in these characters. e.g if you change your encoding say to utf-8 from your browsers setting then probably you will notice these charcter will change into arabic words.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.