I've found a great SMTP class file that supports file attachments. Its just a
few lines of code that base64_encode's the attachment, and sticks it at the end
of the email. I guess just rip whatever code ya need out of this, for doing
attachments, and insert it into your own. Maybe do a little RFC reading to
figure out multiple atachments. =)

(sendmsg() Copyright © 2001 Wanja Hemmerich)
<?
function sendmsg($to, $subject, $text, $from, $file, $type) {
 $content = fread(fopen($file,"r"),filesize($file));
 $content = chunk_split(base64_encode($content));
 $uid = strtoupper(md5(uniqid(time())));
 $name = basename($file);

 $header = "From: $from\nReply-To: $from\n";
 $header .= "MIME-Version: 1.0\n";
 $header .= "Content-Type: multipart/mixed; boundary=$uid\n";

 $header .= "--$uid\n";
 $header .= "Content-Type: text/plain\n";
 $header .= "Content-Transfer-Encoding: 8bit\n\n";
 $header .= "$text\n";

 $header .= "--$uid\n";
 $header .= "Content-Type: $type; name=\"$name\"\n";

 $header .= "Content-Transfer-Encoding: base64\n";
 $header .= "Content-Disposition: attachment; filename=\"$name\"\n\n";
 $header .= "$content\n";

 $header .= "--$uid--";

 mail($to, $subject, "", $header);

 return true;
}
?>

--
>From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts
and Software on your Site. http://www.phpgalaxy.com/aff/

Also, get a fast free POP3 email account, you @php.la at
http://www.phpgalaxy.com/search/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to