Simon Cox
asked on
CSV files stripped from email sent via PHP script
Our issue is as follows. Emails are sent to an SBS2003 server via a PHP script - the attachemtent is a simple CSV file. We can receive the file and are running Exchange 2007 however the recipient gets the following email both internally and via OWA. We also have the same problem when sending to another SBS2003 server. I have attached the PHP script.
Cheers Simon
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="R***H***123"
Message-Id: <20080620075732.BE7E117D06 79@123631- ftp1.urban *****.com>
Date: Fri, 20 Jun 2008 02:57:32 -0500 (CDT)
X-Spam: [F=0.4826833394; B=0.500(0); CM=0.500; MH=0.500(2008062003); R=0.600(10852012539); S=0.383(2008052701); SS=0.500; SC=none]
X-MAIL-FROM: <apache@123631-ftp1.urban* ****.com>
X-SOURCE-IP: [74.***.126.***]
X-AnalysisOut: [v=1.0 c=1 a=yTYxI62HnN/3kBiX9mLl5Q== :17 a=8gbDEKxhH1KCzB_z]
X-AnalysisOut: [nYEA:9 a=vwKfExwf_oOp2VpywQwpY2dD rvsA:4 a=I7_3IfUV4NgA:10 ]
X-AnalysisOut: [a=IH9376qGKM7Ep32upmUA:9 a=-kqo6GrQS2aUI4clCXNGC5Xc yqUA:4 ]
X-AnalysisOut: [a=O58u2wXj750A:10 a=4a0V8oAklmkA:10]
Return-Path: apache@123631-ftp1.urban** ***.com
X-OriginalArrivalTime: 20 Jun 2008 07:57:34.0300 (UTC) FILETIME=[4C6531C0:01C8D2A B]
Please see the latest csv file attached.
--R***H***123
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Please see the latest csv file attached.
--R***H***123
Content-Type: text/csv; name="real.csv"
Content-Transfer-Encoding: base64
Content-disposition: attachment; file="real.csv"
T1JERVIgTlVNQkVSLCBEQVRFIE 9GIE9SREVS LCBTVE9DSy BDT0RFLCBR VFksIERFTE lWRVJZIEFE
RFJFU1MgTElORSAxLCBERUxJVk VSWSBBRERS RVNTIExJTk UgMiwgREVM SVZFUlkgQU REUkVTUyBM
SU5FIDMsIERFTElWRVJZIEFERF JFU1MgTElO RSA0LCBERU xJVkVSWSBB RERSRVNTIE xJTkUgNSwg
UE9TVENPREUsIFRFTEVQSE9ORS wgRU1BSUwg QUREUkVTUw pPcmRlciBO bzogMTIxMz k0Mjk4NDk3
NDEsIDIwLzA2LzA4LCBSSDFGMD AwNCwgMSwg TmljaG9sYS BHcmVlbiwg QmVlY2h3b2 9kIE5vcnRo
ZmllbGQgTGFuZSwgSGlnaGJ1cn RvbiwgSHVk ZGVyc2ZpZW xkLCBVbml0 ZWQgS2luZ2 RvbSwgSGQ4
IDBxdCwgUGhvbmU6IDAxNDg0ID YwNjM5NSwg bmljaG9sYS 5ncmVlbkB2 aXJnaW4ubm V0Cg==
--R***H***123--
Cheers Simon
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="R***H***123"
Message-Id: <20080620075732.BE7E117D06
Date: Fri, 20 Jun 2008 02:57:32 -0500 (CDT)
X-Spam: [F=0.4826833394; B=0.500(0); CM=0.500; MH=0.500(2008062003); R=0.600(10852012539); S=0.383(2008052701); SS=0.500; SC=none]
X-MAIL-FROM: <apache@123631-ftp1.urban*
X-SOURCE-IP: [74.***.126.***]
X-AnalysisOut: [v=1.0 c=1 a=yTYxI62HnN/3kBiX9mLl5Q==
X-AnalysisOut: [nYEA:9 a=vwKfExwf_oOp2VpywQwpY2dD
X-AnalysisOut: [a=IH9376qGKM7Ep32upmUA:9 a=-kqo6GrQS2aUI4clCXNGC5Xc
X-AnalysisOut: [a=O58u2wXj750A:10 a=4a0V8oAklmkA:10]
Return-Path: apache@123631-ftp1.urban**
X-OriginalArrivalTime: 20 Jun 2008 07:57:34.0300 (UTC) FILETIME=[4C6531C0:01C8D2A
Please see the latest csv file attached.
--R***H***123
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding:
Please see the latest csv file attached.
--R***H***123
Content-Type: text/csv; name="real.csv"
Content-Transfer-Encoding:
Content-disposition: attachment; file="real.csv"
T1JERVIgTlVNQkVSLCBEQVRFIE
RFJFU1MgTElORSAxLCBERUxJVk
SU5FIDMsIERFTElWRVJZIEFERF
UE9TVENPREUsIFRFTEVQSE9ORS
NDEsIDIwLzA2LzA4LCBSSDFGMD
ZmllbGQgTGFuZSwgSGlnaGJ1cn
IDBxdCwgUGhvbmU6IDAxNDg0ID
--R***H***123--
<?php
$to = "richard@urban*****.**";
$file_name = "real.csv";
$subject = "R*** H*** Orders";
$bound_text = "R***lH***1234";
$bound = "--".$bound_text."\r\n";
$bound_last = "--".$bound_text."--\r\n";
$headers = "From: do_not_reply@r***lh***.co.uk\r\n";
$headers .= "MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"$bound_text\"";
$message = "Please see the latest csv file attached.\r\n$bound";
$message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"
."Content-Transfer-Encoding: 7bit\r\n\r\n"
."Please see the latest csv file attached.\r\n"
.$bound;
$file = file_get_contents("/var/www/html/r***h***/" . $file_name);
$message .= "Content-Type: text/csv; name=\"$file_name\"\r\n"
."Content-Transfer-Encoding: base64\r\n"
."Content-disposition: attachment; file=\"$file_name\"\r\n\r\n"
.chunk_split(base64_encode($file))
.$bound_last;
mail($to, $subject, $message, $headers);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER