views:

110

answers:

0

Hi!

I have problem with PHP mailer.

I try to send email with Embedded Image.

The php mailer send only the first image from attachment.

My Code:

Get path to all image in html using simple_html_dom.php

foreach($ht->find('img') as $img)
        {
            $val=$img->src;

                $val=explode('/',$val);//
                $count=count($val);//

            $img->src='cid:attach_'.$i;//
            $img->alt=$val[$count-1];//
            $img->width=null;
            $img->height=null;
        //  var_dump($val[$count-1]);
            $attach[$i]['src']='../useruploads/'.$temple->id_user.'/images/'.$val[$count-1];
            $attach[$i]['cid']='attach_'.$i;
            $attach[$i]['alt']=$val[$count-1];

        $i++;
        }

And in function to send email I have loop:

while($attach[$i]['src'])
            {
            $mail->AddEmbeddedImage($attach[$i]['src'], $attach[$i]['cid'], $attach[$i]['alt']);
            $i++;

            }

I can't find the bug.