<?php
$to = 'recipient@example.com';
$subject = 'This is the subject';
$headers = "From: sender@example.com\r\nReply-To: sender@example.com\r\n"
. "Content-Type: multipart/alternative; boundary=\"1234567890\"";
$attachment = chunk_split(base64_encode(file_get_contents('attachment.zip')));
$message =
"--1234567890
Content-Type: multipart/alternative; boundary=\"abcdefghij\"
--abcdefghij
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
This is the text version of the message.
--abcdefghij
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
<div>This is the html version of the message.</div>
--abcdefghij--
--1234567890
Content-Type: application/zip; name=\"attachment.zip\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
" . $attachment . "
--1234567890--";
mail($to, $subject, $message, $headers);
?>