Hallo, ich habe in diesem forum folgendes script gefunden und ein
wenig modifiziert., es versendet eine html mail mit bild.
Leider habe ich keine idee ich das bild zwichen zwei html-tags bekomme.
z.B:
<table>
<tr>
<td> --> Text <--</td>
<td> --> Bild <-- </td>
<td> --> Text <--</td>
</tr>
</table>
Hat da jemand eine Idee wie ich das hin bekomme?
Hier mein Script:
Gruß Rover
wenig modifiziert., es versendet eine html mail mit bild.
Leider habe ich keine idee ich das bild zwichen zwei html-tags bekomme.
z.B:
<table>
<tr>
<td> --> Text <--</td>
<td> --> Bild <-- </td>
<td> --> Text <--</td>
</tr>
</table>
Hat da jemand eine Idee wie ich das hin bekomme?
Hier mein Script:
PHP-Code:
$charset = "iso-8859-1";
//load the attachment from disk
$attach_file_name = "logo.jpg";
$handle = fopen($attach_file_name, "r");
$attach_content = fread($handle, filesize($attach_file_name));
fclose($handle);
$themessage = "Dies <b>ist</b> die Nachricht";
$to = "rover@fawissel.de";
$subject = "from php mail";
$xtra = "From:rover@fawissel.de (Absender)\n";
$xtra .= "MIME-Version: 1.0\n";
$xtra .= "Content-Transfer-Encoding: 8bit\n";
$xtra .= "Content-Type: multipart/mixed; boundary=\"". $boundary . "\"\n\n";
$xtra .= "--" . $boundary . "\n";
$xtra .= "Content-Type: text/html; charset=\"" . $charset . "\"\n";
$xtra .= "Content-Transfer-Encoding: 7bit";
$message = $themessage . "\n\n";
$message .= "--" . $boundary . "\n";
$message .= "Content-Type: image/gif; name=\"" . $attach_file_name . "\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment; filename=\"" . $attach_file_name . "\"\n\n";
//encode the attachment with BASE64
$attach = chunk_split(base64_encode($attach_content));
$message .= $attach;
$message .= "\n--" . $boundary . "--\n";
mail($to, $subject, $message, $xtra);
print ("ok");
echo "$attachy<br><br>$boundary";
Kommentar