brentar Posted April 24, 2009 Share Posted April 24, 2009 I have an online application form. I tested and wrote it on a windows machine.. once it switched to the "live" server which is Linux, it all went downhill. There should always be 2 attachments sent out and any attachments the user added. Only one comes through properly and the rest come up garbled. The files upload to the server fine... must be a header problem or a mime issue. Any thoughts???? Thanks in advance. I am guessing it is something silly between windows/linux. I just can't find it. I also told the company to switch so that both servers are the same! Here are the main pieces of code. $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $infoFile_type = "application/octet-stream";// File Type $file = $_FILES['uploadedfile']['name'][0]; $files = fopen($fileatt,'rb'); $data = fread($files,filesize($fileatt)); fclose($files); $data = chunk_split(base64_encode($data)); $email_from = "[email protected]"; // Who the email is from $headers = "From: " . $email_from . "\n"; $headers .= "MIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"\n"; // $headers .= "From: ".$email_from; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $message .= "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"; $message .= "--{$mime_boundary}\n"; unset($data); unset($file); unset($fileatt); unset($fileatt_type); unset($fileatt_name); Link to comment https://forums.phpfreaks.com/topic/155526-mail-header-issue-again/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 24, 2009 Share Posted April 24, 2009 Is there anything different between the type/content of the files that work and those that don't? Do plain text files work and binary don't? Link to comment https://forums.phpfreaks.com/topic/155526-mail-header-issue-again/#findComment-818431 Share on other sites More sharing options...
brentar Posted April 24, 2009 Author Share Posted April 24, 2009 It seems that the one file always goes through and the rest dont. The content/type are the same for all 5. I can add in all the code for all 5 if it helps Link to comment https://forums.phpfreaks.com/topic/155526-mail-header-issue-again/#findComment-818463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.