php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20056 mail() hangs when e-mail is too big.
Submitted: 2002-10-24 05:23 UTC Modified: 2002-10-28 10:48 UTC
From: webmaster at a-display dot net Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.2.3 OS: Windows XP Pro
Private report: No CVE-ID: None
 [2002-10-24 05:23 UTC] webmaster at a-display dot net
This bug happends only on 4.2.3/Win XP/IIS, (developpement site) our web site runs the scripts corectly on 4.2.3/Linux/Appache.

Whe have a function to send by e-mail a web page from our site, including pictures (mime multipart) if used.

All works fine, but on our developpement system (XP/IIS) it seems that only very small message works (2kb ok, 7 kb hangs)

To send mime compliant message all text is prepared in a single string $mtext and sent with:

$is_sent=mail($to, $subject,"",$mtext);

result is a send a report bug window to microsoft after a 5 sec wait.

Printing text with flush() during script made us sure the bug is in the mail function.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-24 08:23 UTC] sander@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-25 05:59 UTC] webmaster at a-display dot net
The scripts no more hangs the machine, but ... does'nt work any more.

Outlook express cant't recognise the mime format.

The difference between the results of the same script on Linux/4.2.3 and XP/4.3 seem to be "\r\n\r\n" are changed to "\r\n".

I'm not sure, but i think the double /r/n/r/n was compulsory in some cases to separate mime blocks

Tried "\r\n \r\n" instead, witch is not changed but it does not work.

Everything else "\r\n\r\n\n\r" ... is each time changed to "\r\n".
 [2002-10-28 07:57 UTC] iliaa@php.net
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. 

Thank you for your interest in PHP.

Sounds like a configuration issue with your Windows' SMTP server.
 [2002-10-28 08:35 UTC] webmaster at a-display dot net
Sory, I dont't think it's a SMTP configuration error as everthing was ok with the SMTP server before the update to PHP 4.3.

With 4.2.3, big strings in the "additional_headers" parameter where causing PHP HANG (and not SMTP server). Smaller strings where ok and unmodified.

With 4.3, PHP no more hangs, BUT The strings in "additional_headers" are modified (no double CR/LF allowed).

The SMTP Server is listening to usual port, and sends e-mails correctly without touching any part of the mail when comming from ather apps than PHP.
 [2002-10-28 10:48 UTC] webmaster at a-display dot net
Ok, i'm not mad, i found in sendmail.c in php-4.3.0pre2\win32


/* This pattern removes \r\n from the start of the string,
 * \r\n from the end of the string and also makes sure every line
 * is only wrapped with a single \r\n (thus reduces multiple
 * occurences of \r\n between lines to a single \r\n) */
#define PHP_WIN32_MAIL_RMVDBL_PATTERN	"/^\r\n|(\r\n)+$/m"
#define PHP_WIN32_MAIL_RMVDBL_REPLACE	""


This causes my pb (with 4.3), as mime client i've tested use multiple \r\n to separate fields ( a least outlok express uses and needs that ).
 [2002-11-09 21:24 UTC] na at mrmachine dot net
I have also experienced this bug using 4.2.3 on Windows XP Pro SP1 IIS.

I use the same method to construct and send a mail:

$success = mail($to, $subject, null, $headers);

I have done many tests to ensure that my headers are correctly formed, and I did not experience this problem on an OpenBSD 3.1 box running PHP 4.2.3 and Apache.

The occurs seemingly based purely on total size of headers, as I can send any combination of message and/or attachment(s), as long as it's not more than a few kb.

Both web servers share the same mail server which is QMail 1.0.3 running on OpenBSD 3.1, which correctly sends mail of any size from OpenBSD/Apache, but will only send small mail from Windows XP/IIS.

I have even tried the QMail server that my ISP provides with the same results.

The error appears to be related to msvcrt.dll which I believe has been changed with Windows XP SP1. Is this DLL used to "speak" to the mail server? I find that an older version is also distributed with SecureCRT (but is not stored anywhere in the system PATH).

The Application error that shows up in my event log follows:

Faulting application php.exe, version 0.0.0.0, faulting module msvcrt.dll, version 7.0.2600.1106, fault address 0x0002f078.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

0000: 41 70 70 6c 69 63 61 74   Applicat
0008: 69 6f 6e 20 46 61 69 6c   ion Fail
0010: 75 72 65 20 20 70 68 70   ure  php
0018: 2e 65 78 65 20 30 2e 30   .exe 0.0
0020: 2e 30 2e 30 20 69 6e 20   .0.0 in 
0028: 6d 73 76 63 72 74 2e 64   msvcrt.d
0030: 6c 6c 20 37 2e 30 2e 32   ll 7.0.2
0038: 36 30 30 2e 31 31 30 36   600.1106
0040: 20 61 74 20 6f 66 66 73    at offs
0048: 65 74 20 30 30 30 32 66   et 0002f
0050: 30 37 38                  078     

I will try the latest snapshot now also, but believe stripping \r\n\r\n may cause me headache's too. Perhaps it should only strip replace \r\n\r\n(\r\n)+ with \r\n\r\n to eliminate additional unecessary returns.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC