|
Posted by Captain Paralytic on 02/12/07 11:44
On 12 Feb, 11:30, "Andrea" <andr...@tin.it> 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 <sen...@domain.org>\n";
> $header .= "CC: Altro Ricevente <blabla...@domain.net>\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("recei...@domain.com", $subject, $message, $header) ) echo
> "e-mail sent!";
> else echo "error sending the e-mail!";
> ?>
Can you see images in anoy other emails in Outlook?
Navigation:
[Reply to this message]
|