|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35804 Problem with sending mails and attachment
Submitted: 2005-12-25 22:09 UTC Modified: 2005-12-25 22:24 UTC
From: heini_net at gmx dot de Assigned:
Status: Not a bug Package: Mail related
PHP Version: 5.1.1 OS: Windows 2003
Private report: No CVE-ID: None
 [2005-12-25 22:09 UTC] heini_net at gmx dot de

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 :

function sendmail ($Sender,$Senderadresse, $Empfaenger, $Betreff, $Mitteilung,$Dateiname, $Dateibezeichnung,$Dateityp)
$Header = "From: $Sender <$Senderadresse>"; 
$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"; }




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-25 22:24 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 02:01:30 2024 UTC