Problem with sending Cyrillic Email with PHP. My side: Server IIS - Database MsSQL - email server: Exchange 2010 /communication via PHP EWS/
Reciever is UA Goverment owned company with their specific software for receiving emails. It is working with MS Outlook /manually send/.
I tried send it as text /not html/ or i tried PHP Mailer, i also already tried with C# /all are not working with this specific company /on gmail or hotmail it's working fine//.
$ews = new ExchangeWebServices($server, $username, $password);
$msg = new EWSType_MessageType();
$toAddresses = array();
$toAddresses[0] = new EWSType_EmailAddressType();
$toAddresses[0]->EmailAddress =;
$toAddresses[0]->Name =;
$msg->ToRecipients = $toAddresses;
$fromAddress = new EWSType_EmailAddressType();
$fromAddress->EmailAddress =;
$fromAddress->Name =;
$msg->From = new EWSType_SingleRecipientType();
$msg->From->Mailbox = $fromAddress;
$msg->Subject = "Test";
$msg->Body = new EWSType_BodyType();
$msg->Body->BodyType = 'HTML'; //Text HTML
$msg->Body->_ = $UAText;
$msgRequest = new EWSType_CreateItemType();
$msgRequest->Items = new EWSType_NonEmptyArrayOfAllItemsType();
$msgRequest->Items->Message = $msg;
$msgRequest->MessageDisposition = 'SendAndSaveCopy';
$msgRequest->MessageDispositionSpecified = true;
$response = $ews->CreateItem($msgRequest);
var_dump($response);
Thank You,
If its working with an normal Outlook client, however not with your solution my first check would be to compare the header from two example emails (one from outlook and one from your solution). I think that the content-type is set correctly with Outlook however not with your solution.
So you might wish to set the content encoding to UTF-8 in your solution. So I assume the content inside $UAText is some HTML stuff. You might therefore wish to flag that part as UTF-8 via:
and see how it works.
Additional you might wish to set the encoding directly inside your code via:
Note: Here is a good starting point regarding the content-type encoding option. You also might wish to check the official Microsoft howto here.