title: php email script does not produce an HTML version or attachment extension. what went wrong?
body: <p>here's (all) the code:</p>
  
  <pre><code>&lt;?php
  /*
  
              WHITE SPACE MATTERS IN THIS DOCUMENT
  
  */
  include("_php/ChromePhp.php");
      // define receiver of email
  $to = "person@place.com";
      // define subject of email
  $subject = "&lt;--== KABAM!  HTML Email from WR! ==--&gt;";
      // define message to send.  use /n for linebreaks
  //$message = 'This is the message.  Read it.  Love it.';
      // create a boundary string.  it must be unique!
  $uniqID = md5(date('r', time()));
      // define the headers. separated by \r\n
  $headers = "From: some dude" . "\r\n";
  $headers .= "Reply-To: nobody" . "\r\n";
  $headers .= "MIME-Version: 1.0" . "\r\n";
  $headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$uniqID."\""."\r\n";
      // read the attachment into a string, encode it and then
      // split it into smaller chunks
  $attachment = chunk_split(base64_encode(file_get_contents('./_dox/pdftmp/emailTESTER.zip')));
      // define the body of the message
  ob_start(); // turn on output buffering
  ?&gt;
  --PHP-mixed-&lt;?php print $uniqID; ?&gt;
  Content-Type: multipart/alternative; boundary="PHP-alt-&lt;?php print $uniqID; ?&gt;
  
  --PHP-alt-&lt;?php print $uniqID; ?&gt;
  Content-Type: text/plain; charset="iso-8859-1"
  Content-Transfer-Encoding: 7bit
  
  This is the TEXT email.
  Nothing but pure text.  not really fun...
  
  --PHP-alt-&lt;?php print $uniqID; ?&gt;
  Content-Type: text/html; charset="iso-8859-1"
  Content-Transfer-Encoding: 7bit
  
  &lt;h1&gt;This is the HTML test email.&lt;/h1&gt;
  &lt;h3&gt;Read it.  Love it.&lt;/h3&gt;
  &lt;p&gt;this is all HTML.  without any CSS, mind you...&lt;/p&gt;
  
  &lt;?php include("_php/formEmail.php"); ?&gt;
  
  --PHP-alt-&lt;?php print $uniqID; ?&gt;--
  
  --PHP-mixed-&lt;?php print $uniqID; ?&gt;
  Content-Type: application/zip; name="emailTESTER.zip"
  Content-Transfer-Encoding: base64
  Content-Disposition: attachment
  
  &lt;?php print $attachment; ?&gt;
  --PHP-mixed-&lt;?php print $uniqID; ?&gt;--
  
  &lt;?php
      // copy current buffer contents into $message then delete
      // the contents of the output buffer
  $message = ob_get_clean();
      // send the email
  $mail_sent = @mail($to, $subject, $message, $headers);
      // display a message depending on mail_sent status
  print  $mail_sent ? "Mail Sent: ".$uniqID : "Mail Failed: ".$uniqID;
  ?&gt;
  </code></pre>
  
  <p>and this is what pops out in the email client: (doesn't render...)</p>
  
  <pre><code>This is the TEXT email.
  Nothing but pure text.  not really fun...
  
  --PHP-alt-a0d18dbf6c6ec8fb30c47adc84234c75Content-Type: text/html; charset="iso-8859-1"
  Content-Transfer-Encoding: 7bit
  
  &lt;h1&gt;This is the HTML test email.&lt;/h1&gt;
  &lt;h3&gt;Read it.  Love it.&lt;/h3&gt;
  &lt;p&gt;this is all HTML.  without any CSS, mind you...&lt;/p&gt;
  
  
  --PHP-alt-a0d18dbf6c6ec8fb30c47adc84234c75--
  </code></pre>
  
  <p>the attachment, instead of being "emailTESTER.zip" is simply "Part 2" and no extension.  if i add '.zip', it becomes the correct archive (albeit misnamed) with the correct contents...</p>
  
  <p>i triple checked the boundary lines, i believe they are correctly set.  the only thing that i could think of would be something in the Content-Type declarations...but if it is, i'm blank as to what it might be... i've read all the prior posts on "PHP email HTML blah blah" and while they lent insight, none of them touched on my odd pair of hiccups.  <em>narf</em></p>
  
  <p>so.  what did i miss?  why is it not working correctly/completely?</p>
  
  <p>TIA.</p>
  
  <p>WR!</p>