I am using php internal mail function to send mail, I wrapped it up in a function which UTF8 the process, I found it online.
it works, I sent the email in the code to my GMAIL and to my EXCHANGE server, both in GMAIL and my Outlook client on my PC I get the message just right.
My iPhone is also connected to the exchange and GMAIL accounts, so I get both messages on my iPhone. the iPhone receives the GMAIL message correctly, but the EXCHANGE account shows the message with garbled gibberish text where no-latin characters are.
the example bellow sends Hebrew characters in the subject and in the body. On my iPhone, the subject gets received correctly in Hebrew, but the Hebrew parts in the body of the message are garbled.
can anyone comment on that ? maybe try it on your own setup ?
thanks,
<?php
function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $header);
}
$mymessage = "Hello <BR>";
$mymessage.= "Received: now<BR/><BR/>";
$mymessage.= "details: שלום שלום<BR/><BR/>";
mail_utf8 ("[email protected],[email protected]", "שלום", $mymessage, "my_mail", "[email protected]");
?>
Slow incoming email on an iPhone may be due to problems with your network connections or a glitch that is making the iPhone run slowly. Troubleshoot connections to try to speed up downloads. If this doesn't work, try fixes on the Mail app, the email account and the iPhone's network connections.
To flag an important email in iPhone Mail or iPad Mail: Open the email in the Mail app. Select the Reply icon, then choose Flag. Other options include Mark as Unread, Move to Junk, and Notify Me, which notifies you when someone replies to an email thread.
Because the message is correctly received on your gmail account through your iPhone this is probably a bug/misconfiguration on the exchange server or in the iPhone Exchange synchronisation.
The best thing to do would be to base64 encode not only the subject but the whole message: the characters base64 uses are almost always transferred correctly since the character codes are the same in US-ASCII, ISO-8859-x and UTF-8. All modern mail clients can decode base64, but it does increase the size of your message by about 33%.
function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
$header_ = 'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/plain; charset=UTF-8' . "\r\n" .
'Content-Transfer-Encoding: base64' . "\r\n";
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', base64_encode($message), $header_ . $header);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With