...

View Full Version : mail with attachments



angst
07-30-2007, 06:25 PM
Hello,

I'm trying to send an email with a single attachment, and having issues.

I've gone through all the posts on there regarding the subject, and have been unable to make anything work.

my code so far:



// Generate a boundary string
$mime_boundary = md5(uniqid(time()));

// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";

// Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";

$message .= "--{$mime_boundary}\n" .
"Content-Type: application/pdf;\n" .
" name=\"20070730121144.pdf\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"20070730121144.pdf\"\n" .
"Content-Transfer-Encoding: base64\n\n\n\n" .
"--{$mime_boundary}--\n";

// Send the message
mail($to, $subject, $message, $headers);




I can see the attachment in the email, but it comes up 0 kb.

any ideas?

thanks in advance for your time!
-Ken



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum