#32228 [NEW]: broken email with attachments
| From: | vlada dot misic at service24 dot at | Date: | Tue, 08 Mar 2005 00:53:48 +0000 |
| Subject: | #32228 [NEW]: broken email with attachments | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75095@lists.php.net to get a copy of this message | ||
From: vlada dot misic at service24 dot at
Operating system: w2k/xp/win 2003
PHP version: 4.3.9
PHP Bug Type: Mail related
Bug description: broken email with attachments
Description:
------------
The problem is that mail function does not parse correct parameters when
sending emails. It does not prints out all new line characters which are
sent in the header.
I marked those missing \n in the example.
I also found the same problem here
http://aspn.activestate.com/ASPN/Mail/Message/php-windows/2508303
I made a lot of tests and seem to be general problem on any windows
platform or version of PHP. When I open the source of broken email and
just add those four missing \n in the ascii editor the email becomes
correct and attacment also.
I also noticed that all \n chars missing in the message body. So I think
it is general problem with \n chars in the process of generating email
message.
Reproduce code:
---------------
$header .= "Content-Type: multipart/mixed; boundary=$uid\n\n";
$header .= "--$uid\n";
$header .= "Content-Type: text/plain;\n";
$header .= "\t";
$header .= "charset=\"iso-8859-1\"\n";
$header .= "Content-Transfer-Encoding: quoted-printable\n\n"; //the
second \n is missing
$header .= "$message\n\n"; //the second \n is missing
$header .= "--$uid\n";
$header .= "Content-Type: application/msword;\n";
$header .= "\t";
$header .= "name=\"invoice.doc\"\n";
$header .= "Content-Transfer-Encoding: base64\n";
$header .= "Content-Disposition: attachment;\n";
$header .= "\t";
$header .= "filename=\"invoice.doc\"\n\n"; //the second \n is missing
$invoice = chunk_split(base64_encode($invoice));
$header .= "$invoice\n\n"; //the second \n is missing
$header .= "--$uid\n";
Expected result:
----------------
Content-Type: multipart/mixed;
boundary=_NextPart_5901498AE5B7167A32D274DEED0E3965
Return-Path: me@localhost.com
Message-ID: <SAMMYoUH8qwpEWZ1Aeh00000004@sammy>
X-OriginalArrivalTime: 08 Mar 2005 00:06:57.0578 (UTC)
FILETIME=[BE4B58A0:01C52372]
--_NextPart_5901498AE5B7167A32D274DEED0E3965
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Some content - first line
some content - third line (one is empty)
--_NextPart_5901498AE5B7167A32D274DEED0E3965
Content-Type: application/msword;
name="invoice.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="invoice.doc"
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAApwAAAAAAAAAA
...... !!!! not complete attachment since it is irrelevant !!!! .....
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
--_NextPart_5901498AE5B7167A32D274DEED0E3965
Actual result:
--------------
Content-Type: multipart/mixed;
boundary=_NextPart_5901498AE5B7167A32D274DEED0E3965
Return-Path: me@localhost.com
Message-ID: <SAMMYoUH8qwpEWZ1Aeh00000004@sammy>
X-OriginalArrivalTime: 08 Mar 2005 00:06:57.0578 (UTC)
FILETIME=[BE4B58A0:01C52372]
--_NextPart_5901498AE5B7167A32D274DEED0E3965
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Some content - first line
some content - third line (one is empty)
--_NextPart_5901498AE5B7167A32D274DEED0E3965
Content-Type: application/msword;
name="invoice.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="invoice.doc"
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAApwAAAAAAAAAA
...... !!!! not complete attachment since it is irrelevant !!!! .....
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
--_NextPart_5901498AE5B7167A32D274DEED0E3965
--
Edit bug report at http://bugs.php.net/?id=32228&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32228&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32228&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32228&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32228&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32228&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32228&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32228&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32228&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32228&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32228&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32228&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32228&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32228&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32228&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32228&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32228&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32228&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32228&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32228&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32228&r=mysqlcfg