internal error when mailing...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's my code


<?php
//Thanx to jcwebb at dicoe dot com
//base of the code at php.net is used here
// Is the OS Windows or Mac or Linux
//
if (strtoupper(substr(PHP_OS,0,3)=='WIN')): $eol="\r\n"; elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')): $eol="\r"; else: $eol="\n"; endif;

//Message Subject
$emailsubject="Stammis Internet nyhetsbrev " . date("Y/m/d H:i:s");

//Message Body
ob_start();
require("emailbody.php"); // page for showing in the email (no html and body-tags here)
$body=ob_get_contents(); ob_end_clean();

// Common Headers
//

$headers .= 'From: Stammis Internet <jon@xxxxxxxxxx>'.$eol;
$headers .= 'Reply-To: Stammis Internet <info@xxxxxxxxxxx>'.$eol;
$headers .= 'Return-Path: Stammis Internet <info@xxxxxxxxxxx>'.$eol; // these two to set reply address $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters
$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= "Content-type: text/html; charset=iso-8859-1\n";

// HTML Version
//
$msg = $body.$eol.$eol;

// SEND THE EMAIL(s)
// FROM MYSQL-db
//

require("../phpfunctions/opendb.php");

$sql = "SELECT mail FROM tbusers ORDER BY mail";
$querys = mysql_query($sql);

while ($dbArray = mysql_fetch_array($querys)) {
$dbMail = $dbArray["mail"];

$emailaddress=$dbMail;

ini_set(sendmail_from,'info@xxxxxxxxxxx'); // the INI lines are to force the From Address to be used !
 mail($emailaddress, $emailsubject, $msg, $headers);
ini_restore(sendmail_from);

echo "SENT EMAIL TO $dbMail right now....<br>";
}

mysql_close();
?>

When I tested this script all mails I think was sent, BUT this error showed when the loop hade gone through all posts...


HTTP/1.1 200 OK Date: Wed, 01 Mar 2006 20:41:15 GMT Server: Apache X-Powered-By: PHP/4.4.1 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1
OK
The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, support@xxxxxxxxx and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.



What could have caused this?



/G

ps. YES http://phpmailer.sourceforge.net/ seems very great, but this code above is mostly for testing and experimenting...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux