logo       

Re: mail() with images *embedded*: msg#03603

php.general

Subject: Re: mail() with images *embedded*

At 08:44 24.05.02, you wrote:
I used:

<img src='cid:piccy.jpg>

Which I think was what you had as well.

Then in the mime parts:

Content-Type: image/jpeg; name="piccy.jpg"
Content-Transfer-Encoding: base64
Content-ID: <piccy.jpg>
Content-Disposition: inline; filename="piccy.jpg"

Thanks! That's quite what I have, but the images are attached below the message,
and the images in the message itself are broken :(

Here's some code: I'm reading the message into the variable $html_body...

$html_body =
"This is a multi-part message in MIME format.\n"
. "--$boundary\n"
. "Content-Type: text/html; charset=\"iso-8859-1\"\n"
. "Content-Transfer-Encoding:8bit\n"
. "\n"
. "
Then comes the html part, the picture embedded as follows...

<img src=\"cid:01.jpg\" width=\"600\" height=\"75\"></td>

... after the html I have:

$file = "01.jpg";
$path = "/usr/www/users/muinar/rtj/i/newsletter-title.jpg";
$fp = fopen( $path,"r" );
$attachment = fread( $fp,filesize( $path ) );
$attachment = chunk_split( base64_encode( $attachment ) );
fclose( $fp );
$html_body .= "--$boundary\n"
. "Content-Type: image/jpeg; name=\"$file\"\n"
. "Content-Transfer-Encoding: base64\n"
. "Content-ID: <$file>\n"
. "Content-Disposition: inline; filename=\"$file\"\n"
. "\n"
. $attachment . "\n"
. "\n\n";

The encoding works, the message looks fine, just the images are not embedded
but attached. Aaargh :(



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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise