Sorry, this has what to do with Cake? On Feb 12, 6:32 am, "Andrea" <[EMAIL PROTECTED]> wrote: > Hi, > I'm writing a php code to send email in mime format. > All seams ok if I read the email with outlook express, or Thunderbird, > or any webmail, but if I open the email with Outlook 2003, I can't see > the images, I just see a small box (I send 1 image) with inside the > path of the image. > The image is embedded in the message, it's not a link. > What am I doing wrong??? > Here is the code: > > <?php > $header = "From: Sender <[EMAIL PROTECTED]>\n"; > $header .= "CC: Altro Ricevente <[EMAIL PROTECTED]>\n"; > $header .= "X-Mailer: Our Php\n"; > > $boundary = "==String_Boundary_x" .md5(time()). "x"; > $boundary2 = "==String_Boundary2_y" .md5(time()). "y"; > > $header .= "MIME-Version: 1.0\n"; > $header .= "Content-Type: multipart/related;\n"; > $header .= " type=\"multipart/alternative\";\n"; > $header .= " boundary=\"$boundary\";\n\n"; > > $messaggio = "If you read this, your email client doesn't support MIME > \n\n"; > > $message .= "--$boundary\n"; > $messag .= "Content-Type: multipart/alternative;\n"; > $message .= " boundary=\"$boundary2\";\n\n"; > > $message .= "--$boundary2\n"; > $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; > $message .= "Content-Transfer-Encoding: 7bit\n\n"; > $message .= "Alternative message in plain text format.\n\n"; > > $message .= "--$boundary2\n"; > $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; > $message .= "Content-Transfer-Encoding: 7bit\n\n"; > $message .= "<html><body><p>This message is in <i>html</i> format but > has a plain text part.</p><p>Visit the website <a > href=\"http://www.xxxxxx.com\">www.xxxxxxxxx.com</a><img > src=\"cid:image1\"></p></ > body></html>\n"; > > $message .= "--$boundary2--\n"; > > $message .= "--$boundary\n"; > $message .= "Content-ID: <image1>\n"; > $message .= "Content-Type: image/jpeg\n"; > $message .= "Content-Transfer-Encoding: base64\n\n"; > > $attached = "./images/image1.jpg"; > $file = fopen($attached,'rb'); > $data = fread($file,filesize($attached)); > fclose($file); > > $data = chunk_split(base64_encode($data)); > $message .= "$data\n\n"; > > $message .= "--$boundary--\n"; > > $subject = "message with inline(embedded) image"; > > if( @mail("[EMAIL PROTECTED]", $subject, $message, $header) ) echo > "e-mail sent!"; > else echo "error sending the e-mail!"; > ?>
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---