Hallo Mitstreiter, ich möchte eine E-Mail mit Bild (das nicht nachgeladen werden soll) versenden. Das script hat irgend eine Macke: in der verschickten E-Mail steht am Ende nur der Text und der Alternativtext des imgages.
$Empfaenger = "die@adresse.de";
$Sender = "dieAndere@adresse.de";
$Betreff = "Gruesse!";
$Trenner = md5(uniqid(time()));
$Header = "From: Absender<$Sender>";
$Header .= "\r\n";
$Header .= "MIME-Version: 1.0";
$Header .= "\r\n";
$Header .= "Content-Type: multipart/related; boundary=$Trenner";
$CID = md5(uniqid(rand(),1));
$ImgName = "logo.gif";
$ImageLocation = "img/logo.gif";
$MailBody = "--".$Trenner."\r\n";
$MailBody.= "Content-Type: Text/HTML; charset=iso-8859-1\r\n";
$MailBody.= "Content-Transfer-Encoding: quoted-printable\r\n\r\n";
$MailBody.="<html><body>Hier steht mein Text <img src=\"cid:".$CID.$ImgName."\" alt=\"Bild\"></body></html>";
$MailBody.= "\r\n\r\n";
$MailBody.= "--".$Trenner."\r\n";
$MailBody.= "\r\n\r\n";
$fp = fopen ($ImageLocation, "rb");
$str = fread ($fp, filesize ($ImageLocation));
$data = chunk_split(base64_encode($str));
$content.= "Content-Type: image/gif\r\n";
$content.= "Content-ID: <$CID.$ImgName>\r\n";
$content.= "Content-Transfer-Encoding: base64\r\n";
$content.= "Content-Disposition: inline; filename=\"$ImgName\"\r\n\r\n";
$content.= $data;
$MailBody.= $content;
$MailBody.= "--".$mime_boundary."--\r\n";
mail($Empfaenger, $Betreff, $MailBody, $Header);
$Empfaenger = "die@adresse.de";
$Sender = "dieAndere@adresse.de";
$Betreff = "Gruesse!";
$Trenner = md5(uniqid(time()));
$Header = "From: Absender<$Sender>";
$Header .= "\r\n";
$Header .= "MIME-Version: 1.0";
$Header .= "\r\n";
$Header .= "Content-Type: multipart/related; boundary=$Trenner";
$CID = md5(uniqid(rand(),1));
$ImgName = "logo.gif";
$ImageLocation = "img/logo.gif";
$MailBody = "--".$Trenner."\r\n";
$MailBody.= "Content-Type: Text/HTML; charset=iso-8859-1\r\n";
$MailBody.= "Content-Transfer-Encoding: quoted-printable\r\n\r\n";
$MailBody.="<html><body>Hier steht mein Text <img src=\"cid:".$CID.$ImgName."\" alt=\"Bild\"></body></html>";
$MailBody.= "\r\n\r\n";
$MailBody.= "--".$Trenner."\r\n";
$MailBody.= "\r\n\r\n";
$fp = fopen ($ImageLocation, "rb");
$str = fread ($fp, filesize ($ImageLocation));
$data = chunk_split(base64_encode($str));
$content.= "Content-Type: image/gif\r\n";
$content.= "Content-ID: <$CID.$ImgName>\r\n";
$content.= "Content-Transfer-Encoding: base64\r\n";
$content.= "Content-Disposition: inline; filename=\"$ImgName\"\r\n\r\n";
$content.= $data;
$MailBody.= $content;
$MailBody.= "--".$mime_boundary."--\r\n";
mail($Empfaenger, $Betreff, $MailBody, $Header);
Kommentar