I am having trouble sending emails with Arabic content using the PHP mail function. Let's say I have this simple Arabic line:
بريد
I tried several ways to use headers, but the content of the email still ended up with something like: X*X1X(X1Y X/ . However, the email subject is correctly encoded if I use Arabic characters (thanks base64_encode, see Function below)
Here is one of the email features I tried
function sendSimpleMail($to,$from,$subject,$message) { $headers = 'MIME-Version: 1.0' ."\r\n"; $headers .= 'To: '.$to ."\r\n"; $headers .= 'From: '.$from . "\r\n"; $headers .= 'Content-type: text/plain; charset=UTF-8; format=flowed' . "\r\n"; $headers .= 'Content-Transfer-Encoding: 8bit'."\r\n"; mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=',$message, $headers); }
Any suggestions on alternative ways to achieve this?
source share