I'm trying to sending an image via email

From: Date: Sun, 30 Dec 2007 21:29:13 +0000
Subject: I'm trying to sending an image via email
Groups: php.general 
Request: Send a blank email to php-general+get-266389@lists.php.net to get a copy of this message
Hi gang: I'm trying to send an image via email (hmm, must be an echo). In any event, the following is my main-code (word, dude) and a part of the email I receive back. The image file IS there. Any suggestions as to what I'm doing wrong? Cheers, tedd -- the code -- $eol="\r\n"; $mime_boundary=md5(time()); $headers = "From: ".$myName."<".$from.">".$eol; $headers .= "Reply-To: ".$myName."<".$from.">".$eol; $headers .= "Return-Path: ".$myName."<".$from.">".$eol; $headers .= "Message-ID: <".time()."-".$from.">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $headers .= 'MIME-Version: 1.0'.$eol; $headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol; $handle=fopen($filename, 'rb'); $f_contents=fread($handle, filesize($filename)); $f_contents=chunk_split(base64_encode($f_contents)); fclose($handle); $msg = "--".$mime_boundary.$eol; $msg .= "Content-Type: image/jpeg; name=\"".$filename."\"".$eol; $msg .= "Content-Transfer-Encoding: base64".$eol; $msg .= "Content-Disposition: attachment; filename=\"".$filename."\"".$eol.$eol; $msg .= $f_contents.$eol.$eol; mail($to, $subject, $msg, $headers); -- what I receive -- X-Mailer: PHP v5.1.6 MIME-Version: 1.0 Content-Type: multipart/related; boundary="d4a13b4aa61d40214e49820c8f2e2e2f" --d4a13b4aa61d40214e49820c8f2e2e2f Content-Type: image/jpeg; name="tempa.jpg" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="tempa.jpg" /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAZAAA/+4AJkFkb2JlAGTAAAAAAQMA -snip- more of the same -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#266389) next »