We've been getting an error message when trying to call the mail() function: FATAL: emalloc(): Unable to allocate -5675919 bytes Treating that large negative number as an unsigned integer makes that just over 4 gigabytes, which the server blatantly doesn't have. But it doesn't make sense for anything to be requesting that much memory. The script works fine on Linux/Apache, only behaving like this on Windows/IIS. But there are other PHP scripts that send mail successfully on both servers. It isn't a server config issue, because the SMTP and sendmail_from variables are ini_set() in a standard file which is include-ed from both scripts that will send mail and the one which won't. I've been trying to isolate the problem, and can reproduce it completely in a test script which just sends a constant mail -- no database lookups, reading input, fancy HTML output, merely trying to send exactly the same mail each time the script is run. Then I changed things like the `To' and `Subject' headers and the body of the mail. It still doesn't send mail on Windows, but gives a different message: Warning: Server Error in mailo.php on line 40 Now the mail() function does complete, returning false. Has anybody any suggestion as to what could be causing these problems? My entire script (42 lines) is below; most of it is merely debugging print lines so I can see that mail() really is being called with the parameters that I think it is. <? $to = '[EMAIL PROTECTED]'; $subject = 'Test Mail'; $headers = 'Cc: [EMAIL PROTECTED]'; ini_set('SMTP', '194.72.6.62'); ini_set('sendmail_from', '[EMAIL PROTECTED]'); $msg_body = 'This is the body of the test mail message. It has a few lines of text in it, but that is about all. '; $smtp = ini_get('SMTP'); $sendmail_from = ini_get('sendmail_from'); print "##Preparing to send the mail, using the following parameters.<br>\n"; print "##To: [$to] " . strlen($to) . " characters.<br>\n"; print "##Subject: [$subject] " . strlen($subject) . " characters.<br>\n"; print "##Extra Header: [$headers] " . strlen($headers) . " characters.<br>\n"; print "##SMTP Server: [$smtp] " . strlen($smtp) . " characters.<br>\n"; print "##Sendmail From: [$sendmail_from] " . strlen($sendmail_from) . " characters.<br>\n"; $body_lngth = strlen($msg_body); print "##Body (" . $body_lngth . " characters):<br>\n<pre><font face=\"LucidaTypewriter, Courier\">"; $char_num = 0; while ($char_num < $body_lngth) { $col_num = 0; $hex = ''; $ascii = ''; while ($col_num++ < 0x10 && $char_num < $body_lngth) { $char = $msg_body[$char_num]; $hex .= sprintf('%02X ', ord($char)); $ascii .= preg_match('/[\w .,:]/i', $char) ? $char : '#'; $char_num++; } printf("%-48s %s\n", $hex, $ascii); } print "</font></pre>"; print "##Just about to send the mail, as the next statement.<br>\n"; $sent = mail($to, $subject, $msg_body, $headers); print "##The mail command has completed and returned [$sent].<br>\n"; ?> Thanks for help with this. Simon -- Simon Myers * GBdirect http://www.gbdirect.co.uk/ tel: +44 1274 772277 fax: +44 1274 772281 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]