Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with PHP HTML-mail including multiple images
    primarykey
    data
    text
    <p>i'm writing a little mail plugin in php for user information and i want to integrate multiple images in base64 encoding, the problem is, that only the first image is integrated. Any solution? All paths are correct, and html is integrated successfull. If I exchange the order of the images integrated in code, the image displayed in Mail also changes, so both of them are available, but they're not displayed at the same time.</p> <pre><code>&lt;?php $ImageLocation ="images/logo.gif"; $ImageLocationRight ="images/right2.jpg"; $ImgName = "logo.gif"; $ImgNameRight = "right2.jpg"; $MailFrom="Tool"; $MailFromAdr="no_reply@xyz.com"; $MailTo ="xyzr@xyz.com"; $MailToSubject = "$subject"; $CID = md5(uniqid (rand(), 1)); $mime_boundary = "" . md5(uniqid(mt_rand(), 1)); $Header= "From:$MailFrom&lt;$MailFromAdr&gt;\n"; $Header.= "X-mailer: PHP/" . phpversion(). "\n"; $Header.= "MIME-Version: 1.0\n"; $Header.= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"; type=\"text/plain\"\n"; $MailBody = "--".$mime_boundary."\n"; $MailBody.= "Content-Type: Text/HTML; charset=iso-8859-1$EOL"; $MailBody.= "Content-Transfer-Encoding: quoted-printable\n\n"; $MailBody.= file_get_contents("../mail/mail.htm"); $MailBody.= "\n\n"; $MailBody.= "--".$mime_boundary."\n"; $MailBody= str_replace("images/logo.gif", "cid:$CID.$ImgName", $MailBody); $MailBody= str_replace("images/right2.jpg", "cid:$CID.$ImgNameRight", $MailBody); $fpr = fopen ($ImageLocationRight, "rb"); $strr = fread ($fpr, filesize ($ImageLocationRight)); $datar = chunk_split(base64_encode($strr)); $content.= "Content-Type: image/jpg\n"; $content.= "Content-ID: &lt;$CID.$ImgNameRight&gt;\n"; $content.= "Content-Transfer-Encoding: base64\n"; $content.= "Content-Disposition: inline; filename=\"$ImgNameRight\"\n\n"; fclose($fpr); $content.= $datar."\n"; $MailBody.= $content; $MailBody.= "--".$mime_boundary."--\n"; $fp = fopen ($ImageLocation, "rb"); $str = fread ($fp, filesize ($ImageLocation)); $data = chunk_split(base64_encode($str)); $content = ""; $content.= "Content-Type: image/gif\n"; $content.= "Content-ID: &lt;$CID.$ImgName&gt;\n"; $content.= "Content-Transfer-Encoding: base64\n"; $content.= "Content-Disposition: inline; filename=\"$ImgName\"\n\n"; fclose($fp); $content.= $data."\n"; $MailBody.= $content; $MailBody.= "--".$mime_boundary."--\n"; echo $MailBody; mail($MailTo, $MailToSubject, $MailBody, $Header); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload