#32228 [Opn->Bgs]: broken email with attachments
| From: | derick@php.net | Date: | Tue, 08 Mar 2005 09:43:18 +0000 |
| Subject: | #32228 [Opn->Bgs]: broken email with attachments | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75103@lists.php.net to get a copy of this message | ||
ID: 32228
Updated by: derick@php.net
Reported By: vlada dot misic at service24 dot at
-Status: Open
+Status: Bogus
Bug Type: Mail related
Operating System: w2k/xp/win 2003
PHP Version: 4.3.9
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Even if you think it is not a bug, we often know better than you,
please consult the support channels first before even considering
to reopen this report.
Thank you for your interest in PHP.
You're abusing the header parameter for email content (body).
Previous Comments:
------------------------------------------------------------------------
[2005-03-08 01:53:46] vlada dot misic at service24 dot at
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 this bug report at http://bugs.php.net/?id=32228&edit=1