Email-Attachment

Hallo,

wie kann ich denn beim email-Versand aus einem php-Programm heraus ein Attachment anfuegen?

Habe alle unter mail() und imap_mail() durchgesehen, aber keinen Hinweis darauf gefunden.

Kann mir da jemand weiterhelfen?

Herzlichen Dank
Christian

hier ist eine prima funktion die all dies fuer dich erledigt:

function mail_attach($filenm,$filesize,$filetype,$file_cont,$to,$subject,$from,$mail_cont)
{
$contenttypes = array(
„text/plain“ => array(„encoding“=>„8bit“),
„text/html“ => array(„encoding“=>„8bit“),
„image/gif“ => array(„encoding“=>„base64“),
„image/jpeg“ => array(„encoding“=>„base64“),
„image/png“ => array(„encoding“=>„base64“),
„application/x-zip-compressed“ => array(„encoding“=>„base64“),
„application/x-gzip“ => array(„encoding“=>„base64“),
„application/x-tar“ => array(„encoding“=>„base64“)
);
$mail_header = „From: $from“;

if($contenttypes[$filetype][encoding]==„base64“) $file_cont = chunk_split(base64_encode($file_cont));
else $file_cont = $file_cont;

$boundary = strtoupper(md5(uniqid(time())));

$mail_header .= „\nMIME-Version: 1.0“;
$mail_header .= „\nContent-Type: multipart/mixed; boundary=$boundary“;
$mail_header .= „\n\nThis is a multi-part message in MIME format – Dies ist eine mehrteilige Nachricht im MIME-Format“;

$mail_header .= „\n–$boundary“;
$mail_header .= „\nContent-Type: text/plain“;
$mail_header .= „\nContent-Transfer-Encoding: 8bit“;
$mail_header .= „\n\n$mail_cont“;

$mail_header .= „\n–$boundary“;
$mail_header .= „\nContent-Type: $filetype; name=“$filenm"";

$mail_header .= „\nContent-Transfer-Encoding: „.$contenttypes[$filetype][encoding];
$mail_header .= „\nContent-Disposition: attachment; filename=“$filenm““;
$mail_header .= „\n\n$file_cont“;

$mail_header .= „\n–$boundary–“;

if(@mail($to,$subject,"",$mail_header))
return true;
return false;
}