Page 1 of 1

PHP - Image - Mail [SOLVED]

Posted: Wed Jun 07, 2006 9:03 pm
by tecktalkcm0391
Can you have PHP mail an image, and only an image? Would you just do the image code and then have the output in a variable, and then do something like

Code: Select all

mail(email@site.com, '', $imagefile);
?

Posted: Wed Jun 07, 2006 9:16 pm
by PrObLeM
yes you can. You have to attach the file. look here http://www.php.net/function.mail there are acouple of examples

Re: PHP - Image - Mail

Posted: Wed Jun 07, 2006 9:36 pm
by tecktalkcm0391
So this should work?

Code: Select all

$header  = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail(email@site.com, '', $imagefile, $header);

Posted: Wed Jun 07, 2006 9:42 pm
by PrObLeM
prolly not, check the manual it has a few examples.

Posted: Wed Jun 07, 2006 9:44 pm
by alex.barylski
So you want the image embedded inside your email instead of a soft link (via HTTP)?

You realize that this will quickly use up bandwidth right? Sending a 64KB image to 1000 people...requires alot of it...

Anyways, if I remember correctly...I believe phpMailer makes it quite easy to do this...perhaps it was just attachments...but in anycase...use that class as it will make your mailing life 10 times easier :)

Perhaps you could even look into d11's mailer class...it might do something like this...???

Cheers :)