|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-12-25 22:24 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |
Description: ------------ hi, i have write a php script for sending an email with an attachment. under linux and php 4xx it works fine. but under windows 2003 with php 5.1.1 the attachment image dont show correct. the attachment size is only 3kb but the real size is more. and if i save the attacment. so i can open the attachment and it show correctly. here the code : <?php function sendmail ($Sender,$Senderadresse, $Empfaenger, $Betreff, $Mitteilung,$Dateiname, $Dateibezeichnung,$Dateityp) { $Header = "From: $Sender <$Senderadresse>"; $lb="\r\n"; $Trenner = md5(uniqid(time())); $Header .= $lb; $Header .= "MIME-Version: 1.0"; $Header .= $lb; $Header .= "Content-Type: multipart/mixed; boundary=$Trenner"; $Header .= $lb." ".$lb; $Header .= "This is a multi-part message in MIME format"; $Header .= $lb.$lb; $Header .= "--$Trenner"; $Header .= $lb; $Header .= "Content-Type: text/plain"; $Header .= $lb; $Header .= "Content-Transfer-Encoding: 8bit"; $Header .= $lb.$lb; $Header .= $Mitteilung; $Header .= $lb; $Header .= "--$Trenner"; $Header .= $lb; $Header .= "Content-Type: $Dateityp; name=$Dateibezeichnung"; $Header .= $lb; $Header .= "Content-Transfer-Encoding: base64"; $Header .= $lb; $Header .= "Content-Disposition: attachment; filename=$Dateibezeichnung"; $Header .= $lb.$lb; $Dateiinhalt = fread(fopen($Dateiname, "r"), filesize($Dateiname)); $Header .= chunk_split(base64_encode($Dateiinhalt)); $Header .= $lb.$lb; $Header .= "--$Trenner--"; if (mail($Empfaenger, $Betreff,"", $Header)){ $Header = nl2br($Header); echo $Header; return "true"; } } ?>