PHP - mail() with inline image?

Hello,

I am creating a webshop. and now i am going to send the email with the order.
BUT... it needs to be in HTML (no problem), and with inline images (you attach an image to the mail and this is displayed in the mail)

Does anybody know how this can be done??

the script i have:

<?
session_start();
require_once('includes/inc_values.php');
require_once('includes/inc_connection.php');

if(!empty($_COOKIE[COOKIE])){
      list($name, $adres, $zipcode, $location, $telephone, $email, $paymethod, $agree) = split("!", $_COOKIE[COOKIE]);
}
if(!empty($_SESSION['producten_shop'])){
      $producten_ids = substr($_SESSION['producten_shop'], 0, -1);
      $producten_ids = explode("!", $producten_ids);
}
$htmlversion = ("
Your details:<br>
<br>
Naam:                  " . $name. "<br>
Adres:                  " . $adres . "<br>
Postcode:            " . $zipcode. "<br>
Plaats:                  " . $location. "<br>
Telefoon:            " . $telephone. "<br>
Email:                  " . $email . "<br>
<br>
Betaalmethode:            " . $paymethod. "<br>
<br>
Our details:<br>
<br>
Naam:                  " . NAME. "<br>
Adres:                  " . ADRES . "<br>
Postcode:            " . ZIPCODE. "<br>
Plaats:                  " . LOCATION. "<br>
Telefoon:            " . TELEPHONE. "<br>
Email:                  " . EMAIL . "<br>
<br>
Your order::<br>
");

$arraylengte = count($producten_ids);

for($i=0; $i < $arraylengte; $i++){
      $htmlversion .= "product id: " . $producten_ids[$i] . "<br>";
}



error_reporting(E_ALL);
$headers = "From: test@test.nl\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("SHOP");
$headers .= "Content-Type: multipart/alternative" .
   "; boundary = $boundary\r\n\r\n";
$headers .= "This is a MIME encoded message.\r\n\r\n";
$headers .= "--$boundary\r\n" .
   "Content-Type: text/html; charset=ISO-8859-1\r\n" .
   "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($htmlversion));
if(mail("test@test.nl", "Thanks for your order!", "", $headers)){
      $message = "goed";
} else {
      $message = "fout";
}

?>

$_COOKIE[COOKIE] and $_SESSION['producten_shop'] are set in the previous page and contain the account details and products ordered. (all works perfect)

So can anybody help me with the inline images??

thanks, Mike
LVL 5
php-webdesignAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
Use phpmailer.sf.net for this.

It allows easy attachment of inline-images
For a example see http://phpmailer.sourceforge.net/extending.html

So you don't need to reinvent the wheel
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
php-webdesignAuthor Commented:
thank you m8!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.