Hello!!

Use this function...


function sendmsg($to, $subject, $text, $cc, $from, $file, $type) { $content = fread(fopen($file,"r"),filesize($file)); $content = chunk_split(base64_encode($content)); $uid = strtoupper(md5(uniqid(time()))); $name = basename($file); $text = stripslashes($text); $subject = stripslashes($subject);

        $header = "From: $from\nReply-To: $from\n";
        $header .= "Cc: $cc\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: 8bnoit\n\n";
        $header .= "$text\n";
        $header .= "\n";
        $header .= "\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;
}


The call it like this...




sendmsg($to, $subject, $text, $cc, $from, $file, $type);



I didn't write this, forgot who did, I just tweaked it for my tastes (not shown)...




Dan





On Thursday, July 24, 2003, at 3:00 PM, [EMAIL PROTECTED] wrote:


Hi. I'm trying to send email with attachments using PHP and have just about got it based on the example provided by "alex at bartl dot net" on http://us4.php.net/manual/en/ref.mail.php.

The only difficulty I'm having is that the attachment is coming through as part of the message. The message says there is an attachment, but it doesn't give me an icon with the name. I just get the text/html part of the message and then the binary data that makes up the attachment.

I'm thinking it has something to do with the boundaries. I've read everyone's example on that page and followed the links to the 1993 MIME specs on the Mindspring site but am still getting nowhere. Has anyone else ever had this problem? If so, how did you solve it?

Its for a good cause - to allow users to upload resumes to a company. There will be no spam going on with the use of this code.

Thanks for your time and consideration.

Diana           
[EMAIL PROTECTED]                 "Will Work for Chocolate"
http://www.vivaladata.com           (and its worth every byte!)


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to