PHP mail function prepends a spurious character in Windows
<p>I am attempting to use the built-in "mail" function in PHP, which has worked fine for my needs in a hosted LAMP environment with SiteGround. In this case I am running my own server on Windows, and my messages arrive with a spurious character (a capital 'B') prepended to the body text. I have tried replacing $mailBody in the call with a simple 'abc' string, and the spurious capital 'B' is still prepended. I am guessing that the problem is caused by a character-encoding mismatch. I have tried altering the "Content-type" in the header from text/plain to text/html, and the charset from windows-1251 to utf-8, neither of which make any difference.</p>

<pre><code>$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=windows-1251\r\n";
$headers .= "From: $confirmation_sender\r\n";

$bMailSuccess = mail ($strEmail, $business_name . ' Booking Confirmation', $mailBody, $headers);
</code></pre>

<p><strong><code>php.ini</code></strong></p>

<pre><code>SMTP = internalmail
</code></pre>

<p>As you can see, mail is directed to a server called 'internalmail', and the logs on this server suggest that the spurious character is already part of the body text that it receives. Can anyone suggest a fix (preferably other than "install some other mail client")?</p>