php.net |  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
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"; }

}

?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-25 22:24 UTC] tony2001@php.net
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 http://www.php.net/support.php 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: Sat Apr 20 10:01:28 2024 UTC