PHP mail()标头附件第一行收到空白(文件被破坏)

时间:2015-11-26 13:14:31

标签: php email attachment

目前正在将网站从PHP 5.2迁移到PHP 5.6 Web服务器。

标题已发出:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=93ef188fcef0a7216f79ab8c153cbdd8
--93ef188fcef0a7216f79ab8c153cbdd8
Content-Type:image/png; name="marker_default.png"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="marker_default.png"
iVBORw0KGgoAAAANSUhEUgAAABQAAAAiCAMAAABodAmPAAAByFBMVEUAAACdPTedPTehQDqiQDqh
PzmdPTedPTedPTedPTedPTejQTudPTedPTedPTedPTedPTeoRD2gPzmyTUadPTedPTedPTedPTew
S0SgPzmdPTedPTedPTexS0SdPTegPzmhQDqdPTevS0SuSkSiQDqdPTefPzigPzmhQDmiQDquR0Gw
S0ShQDmdPTehPzmdPTefPzihQDm9UUmwSUGdPTedPTe2TES5TkavS0TJV06dPTeiQDqgPznZYFav
SEGhQDqySUK4TUW9UEjBUkqpRT7IVk3EVEuuSEHFVEzIVk3PWlGdPTe4TUWdPTedPTedPTe1TESd
PTedPTf1d21/QDurRj/CVk7lc2l/QDrsdmy7TkfQYlr1f3XHV07JWVHCVU3ld23CVEt/QTyzTEX/
dmqzS0QqFhSxSEH/eGysSEG4TUbsc2n/d2vUXVSePTe+UEgqFRT/f3T/eW3/fHH1fXMqFRP0f3T/
fHD/fnPsd270f3X/h33QYFfHWFDHXFX1f3Z/Qjz1fHP/hHn/gXfrd23/h3z/gXb/gHWuSkQAAAD/
g3ijQDr/e2//fXKtSEH/hnz/gnf0fnSvS0T/eW7/hHr/hXv/em7GXFROeYTzAAAAUnRSTlMAnx/w
4PonMmOSGYiOWQmMIGLp/AwbWn/40qF9Ivig1O8h/PnVJOvy+/2n/O8d/Qjq/ivNCoHdcvmTFP7x
MfDW98jWn7qydMZ0WWUlMhYVB7YGA1O5QAAAAUpJREFUeF5lymOXK1EUhOEdm0PbNq5t7tg2x7Z1
jb8753TUST+far2rIIcvlbU2yqR8KJme6cP5Xxdd+KBOXWgdj3Fvf5vY+o/d+XNPb5XzNG+taryZ
NnXbkPN70c/OhjES63DzL8sJNgHI9Y6VPyyHDr0cVGg7IrwH4fCBly4bqkDTckX5Lwk/M+s1wIv9
oLI0ZpkZ4wHv2zGVi8wkURk4o4w0GpkZUEItJs4Ji3V11WqhK4G1UNO+s1hmR1ADoEDDBosBFQBQ
LTSzo1lYDYRY4Lkt8gyLgSER7S7n7YokkKdD9zrDjTooehG6YYReQ4m23/WPcA1ogWXQ9JswfQG2
kVHf0pJvYhLKTMWj0fgslJvDZBIXKuK9+8Hg9UOo8CiVegKVnmYyzzjxud3+khNfRSJvOPEt4jtO
fI/4gRM/In7ixM/p9NfCvgOq9p5F2Ax/VwAAAABJRU5ErkJggg==
--93ef188fcef0a7216f79ab8c153cbdd8
Content-Type: text/html; charset=cp1252
Content-Transfer-Encoding: 8bit
blah1
blah2
--4232d7272cf9b15a4a438f88a11b6905--

在hotmail中收到的标题:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=4232d7272cf9b15a4a438f88a11b6905
Return-Path: *********
X-OriginalArrivalTime: 26 Nov 2015 12:41:08.0908 (UTC) FILETIME=[B96B96C0:01D12847]

--4232d7272cf9b15a4a438f88a11b6905
Content-Type:image/png; name="marker_default.png"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="marker_default.png"

PzmdPTedPTedPTedPTedPTejQTudPTedPTedPTedPTedPTeoRD2gPzmyTUadPTedPTedPTedPTew
S0SgPzmdPTedPTedPTexS0SdPTegPzmhQDqdPTevS0SuSkSiQDqdPTefPzigPzmhQDmiQDquR0Gw
S0ShQDmdPTehPzmdPTefPzihQDm9UUmwSUGdPTedPTe2TES5TkavS0TJV06dPTeiQDqgPznZYFav
SEGhQDqySUK4TUW9UEjBUkqpRT7IVk3EVEuuSEHFVEzIVk3PWlGdPTe4TUWdPTedPTedPTe1TESd
PTedPTf1d21/QDurRj/CVk7lc2l/QDrsdmy7TkfQYlr1f3XHV07JWVHCVU3ld23CVEt/QTyzTEX/
dmqzS0QqFhSxSEH/eGysSEG4TUbsc2n/d2vUXVSePTe+UEgqFRT/f3T/eW3/fHH1fXMqFRP0f3T/
fHD/fnPsd270f3X/h33QYFfHWFDHXFX1f3Z/Qjz1fHP/hHn/gXfrd23/h3z/gXb/gHWuSkQAAAD/
g3ijQDr/e2//fXKtSEH/hnz/gnf0fnSvS0T/eW7/hHr/hXv/em7GXFROeYTzAAAAUnRSTlMAnx/w
4PonMmOSGYiOWQmMIGLp/AwbWn/40qF9Ivig1O8h/PnVJOvy+/2n/O8d/Qjq/ivNCoHdcvmTFP7x
MfDW98jWn7qydMZ0WWUlMhYVB7YGA1O5QAAAAUpJREFUeF5lymOXK1EUhOEdm0PbNq5t7tg2x7Z1
jb8753TUST+far2rIIcvlbU2yqR8KJme6cP5Xxdd+KBOXWgdj3Fvf5vY+o/d+XNPb5XzNG+taryZ
NnXbkPN70c/OhjES63DzL8sJNgHI9Y6VPyyHDr0cVGg7IrwH4fCBly4bqkDTckX5Lwk/M+s1wIv9
oLI0ZpkZ4wHv2zGVi8wkURk4o4w0GpkZUEItJs4Ji3V11WqhK4G1UNO+s1hmR1ADoEDDBosBFQBQ
LTSzo1lYDYRY4Lkt8gyLgSER7S7n7YokkKdD9zrDjTooehG6YYReQ4m23/WPcA1ogWXQ9JswfQG2
kVHf0pJvYhLKTMWj0fgslJvDZBIXKuK9+8Hg9UOo8CiVegKVnmYyzzjxud3+khNfRSJvOPEt4jtO
fI/4gRM/In7ixM/p9NfCvgOq9p5F2Ax/VwAAAABJRU5ErkJggg==
--4232d7272cf9b15a4a438f88a11b6905
Content-Type: text/html; charset=cp1252
Content-Transfer-Encoding: 8bit
blah1
blah2
--4232d7272cf9b15a4a438f88a11b6905--

Line" iVBORw0KGgoAAAANSUhEUgAAABQAAAAiCAMAAABODAmPAAAByFBMVEUAAACdPTedPTehQDqiQDqh"缺少,无法弄清楚原因。如果附件只有1个base64行,那么它将被删除,文件将作为空白接收。

在迁移到新服务器之前,代码在文件头和base64内容之间有换行符,但PHP 5.6新安全更新要求头不能包含任何空行(Error with PHP mail(): Multiple or malformed newlines found in additional_header

0 个答案:

没有答案