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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: heini_net at gmx dot de
New email:
PHP Version: OS:

 

 [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-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 09:05:53 2023 UTC