title: Problem with character encoding on email sent via PHP?
body: <p>Having some trouble sending properly formatted HTML e-mail from a PHP script. I am running PHP 5.3.0 and Apache 2.2.11 on Windows XP Professional.</p>
  <p>The output looks like this:</p>
  <blockquote>
  <p>Agent Summary for Support on Tuesday April 20 2010=20
  Ext.  Name  Time  Volume<br />
  137  Agent Name    01:27:25  1<br />
  138  =09  00:00:00  0<br />
  139  =09  00:00:00  0</p>
  </blockquote>
  <p>You see the =20 and =09 in there? If you look at the HTML you also see = signs being turned into =3D. I figure this is a character encoding issue as I read the following at Wikipedia:</p>
  <blockquote>
  <p>ISO-8859-1 and Windows-1252 confusion</p>
  <p>It is very common to mislabel text data with the charset label ISO-8859-1, even though the data is really Windows-1252 encoded. In Windows-1252, codes between 0x80 and 0x9F are used for letters and punctuation, whereas they are control codes in ISO-8859-1. Many web browsers and e-mail clients will interpret ISO-8859-1 control codes as Windows-1252 characters in order to accommodate such mislabeling but it is not standard behaviour and care should be taken to avoid generating these characters in ISO-8859-1 labeled content.</p>
  </blockquote>
  <p>This looks like the problem but I don't know how to fix. My code looks like this:</p>
  <pre><code>ob_start();
  report_queue_summary($yesterday,$yesterday,$first_extension,$last_extension,$queue);
  $body_report = ob_get_contents();
  ob_end_clean();
  $body_footer = &quot;This is an automatically generated e-mail.&quot;;
  $message = new Mail_mime();
  $html = $body_header.$body_report.$body_footer;
  $message-&gt;setHTMLBody($html);
  $body = $message-&gt;get();
  $extraheaders = array(&quot;From&quot;=&gt;&quot;***redacted***&quot;,&quot;To&quot;=&gt;$recipient, &quot;Subject&quot;=&gt;&quot;Agent Summary for $yesterday [$queue]&quot;, &quot;Content-type&quot;=&gt;&quot;text/html; charset=iso-8859-1&quot;);
  $headers = $message-&gt;headers($extraheaders);
  
  # setup e-mail;
  $host = &quot;*********&quot;;
  $port = &quot;26&quot;;
  $username = &quot;*****&quot;;
  $password = &quot;*****&quot;;
  
  # Send e-mail
  $smtp = Mail::factory('smtp',
    array ('host' =&gt; $host,
      'port' =&gt; $port,
      'auth' =&gt; true,
      'username' =&gt; $username,
      'password' =&gt; $password));
  
  $mail = $smtp-&gt;send($recipient, $extraheaders, $body);
  
  if (PEAR::isError($mail)) {
    echo(&quot;&quot; . $mail-&gt;getMessage() . &quot;&quot;);
   } else {
    echo(&quot;Message successfully sent!&quot;);
   } 
  </code></pre>
  <p>Is the problem that I'm using output buffering?</p>