doudizhu2222 2013-11-27 20:28
浏览 41

尝试使用php作为附件发送时,CSV不编码

I am trying to create a csv file on the fly and email it. Unfortunately, the file is not being created but the data is being encrypted. Could someone point me in the right direction please? This is the output I receive via email..

'

This is a multi-part message in MIME format.

--NextPart_001

Content-Type: text/plain; charset='us-ascii'

Content-Transfer-Encoding: 7bit

See Attached File

--NextPart_001

Content-Type: text/csv; name='LastName FirstName.csv'

Content-Transfer-Encoding: base64

Content-Disposition: attachment

Rmlyc3QgTmFtZSxMYXN0IE5hbWUsRW1haWwgQWRkcmVzcyxQaG9uZSBOdW1iZXIsQWRkcmVzcyxD aXR5LFN0YXRlLFppcCBDb2RlLE1vbnRoLERheSxZZWFyLEV2ZW50IFR5cGUsRGVzY3JpcHRpb24s U3RhcnQgSG91cixTdGFydCBRdWFydGVyIEhvdXIsU3RhcnQgQU0vUE0sUGljay11cCBBZGRyZXNz LE90aGVyIFN0b3BzLEVuZCBIb3VyLEVuZCBRdWFydGVyIEhvdXIsRW5kIEFNL1BNLEZpbmFsIERl c3RpbmF0aW9uLE51bWJlciBPZiBQYXNzZW5nZXJzLFByZWZlcnJlZCBWZWhpY2xlLEhvdyBkaWQg eW91IGZpbmQgdXMKTWljaGFlbCxQcmF0dCxtaWtlLnByYXR0QGJlc3R0cmFuc3BvcnRhdGlvbi5j b20sMzE0LTIyMi01MzMyLDg1MzEgUGFnZSBBdmUgU3RlIDE2MCxTYWludCBMb3VpcyxNaXNzb3Vy aSw2MzExNC02MDA3LERlYywzMSwyMDEzLFNwZWNpYWwgRXZlbnQsLDk6LDAwLHBtLDEwMTAwIFBp bmVodXJzdCBEcg0KT3ZlcmxhbmQsIE1PIDYzMTE0LEFzIERpcmVjdGVkLCwwMCwsMTAxMDAgUGlu ZWh1cnN0IERyDQpPdmVybGFuZCwgTU8gNjMxMTQsMTAsRXhlY3V0aXZlIE1pbmkgQ29hY2ggMTMg cGF4LE90aGVyCg==

--NextPart_001--

Here is the code I am using...

$cr = "
";

$csvdata = "First Name" . ',' . "Last Name" . ',' . "Email Address" . ',' . "Phone Number" . ',' . "Address" . ',' . "City" . ',' . "State" . ',' . "Zip Code" . $cr;

$csvdata .= $firstname . ',' . $lastname . ',' . $email . ',' . $phone . ',' . $address . ',' . $city . ',' . $state . ',' . $zip . $cr;

$encoded = chunk_split(base64_encode($csvdata));

$thisfile = $lastname . ' ' . $firstname . '.csv';

$to3 = "me@mydomain.com";
$subject3 = "CSV Attachment";
$headers3 = "From: Someone <someone@somedomain.com>
" .   "MIME-Version: 1.0
" .
"Content-type: multipart/mixed; boundary='NextPart_001' . '
'";


$message3 = "This is a multi-part message in MIME format.
--NextPart_001
Content-Type: text/plain; charset='us-ascii'
Content-Transfer-Encoding: 7bit

See Attached File

--NextPart_001
Content-Type: text/csv;  name='$thisfile'
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$encoded
--NextPart_001--";
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录