note 49811 added to function.mail

From: Date: Wed, 09 Feb 2005 10:06:22 +0000
Subject: note 49811 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-84709@lists.php.net to get a copy of this message
Hi Im using a script to send a file to the site admin. It works locally ON WINDOWS (php 4.3.4) but does not on the remote server UNIX (php 4.3.10). In fact on the remote it does send the mail with the data from the input fields but there is no file attached instead its got this : --==Multipart_Boundary_x206067939527cd5646ed2a4c53bdf6c3x Content-Type: application/msword; name="alo.doc" Content-Disposition: attachment; filename="alo.doc" Content-Transfer-Encoding: base64 0M8R4KGxGuEAAAAAAAAAAAAAAAAA AAAAPgADAP7/CQAGAAAAAAAAAAAAA AABAAAAJwAAAAAAAAAA EAAAKQAAAAEAAAD+////AAAAACYAAAD ///////////////////////////////////////// EAAAKQAAAAEAAAD+//// ///////////////////////////////////////// /////////////////////////////////// ///////////////////////////////////////// /////////////////////////////////// ///////////////////////////////////////// //////////////// anyone know what may be wrong? is the problem the difference in php versions? Tnx for reference here is the code relative to sending the file ------------------------ ------------------------ // Obtain file upload vars $fileatt = $_FILES['attachresume']['tmp_name']; $fileatt_type = $_FILES['attachresume']['type']; $fileatt_name = $_FILES['attachresume']['name']; $message=""; $data=""; if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); } // Base64 encode the file data $data = chunk_split(base64_encode($data)); $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $msg .= _JL_RECEIVED_APPLICATION; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n". $msg . "\n\n"; // Add file attachment to the message $message .= "--{$mime_boundary}\n" . " Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n". "--{$mime_boundary}--\n"; ---- Manual Page -- http://www.php.net/manual/en/function.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49811 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49811&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49811&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49811&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49811&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49811&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49811&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84709) next »