From:             heini_net at gmx dot de
Operating system: Windows 2003
PHP version:      5.1.1
PHP Bug Type:     Mail related
Bug description:  Problem with sending mails and attachment

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"; }

}

?>


-- 
Edit bug report at http://bugs.php.net/?id=35804&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35804&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35804&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35804&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35804&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35804&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35804&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35804&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35804&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35804&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35804&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35804&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35804&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35804&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35804&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35804&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35804&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35804&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35804&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35804&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35804&r=mysqlcfg

Reply via email to