I have a db with 126 email addrs. phpmailer did work perfectly, but now, it will get about 1/2 way finished and the browser will lockup> then start to error. I have error trapping to see which emails didnt get sent to, and it is about half.
When I run a test email, the browser locks up, and then when I shut it down... it takes the server a couple of minutes to allow me back into the site?
Any ideas? I am unsure if the ISP has upgraded.
CODE>>
<?php require_once('../Connectio
ns/conn.ph
p'); ?>
<?php
session_start();
$error=0;
require("/home/mallardp/pu
blic_html/
class.phpm
ailer.php"
);
$ref= parse_url(getenv("HTTP_REF
ERER"));
if($ref['host']=="website.
com" || $ref['host']=="
www.website.com"){
$path=1;
}else {$path=0;}
if($ref['path']=="/members
/forum_rep
ly.php"&& $path == 1){
//if(1==1){
$topicheader=$_POST['topic
header'];
$message=$_POST['message']
;
$poster = $_POST['poster'];
$topic_text = $_POST['topic_text'];
$mail = new PHPMailer();
$mail->From = "DoNotReply@website.com";
$mail->FromName = "websiteForum";
$mail->Mailer = "smtp";
$mail->Subject = "Topic: ".$topicheader;
mysql_select_db($database_
website, $website);
$query = "SELECT * FROM users where getforum_email = 1 order by user_id";
$result = @MYSQL_QUERY($query);
while ($row = mysql_fetch_array ($result))
{
// HTML body
$body = "Hello " . $row["fname"] . ", <br><br>";
$body .= "$poster has submitted a reply to the Forum. <br><br>Topic:<b>".$topich
eader."</b
><br>";
$body .= $topic_text."<br><br>Their
Reply:<br>";
$body .= $message;
$body .= "<br><br>If you would like to reply to this message, Login to the <a href=\"
http://www.website.com/login.php\" target=\"blank\">websiteMe
mbers</a> section.<br><br>If you no longer wish to receive emails generated from the websiteForum, Login to your account, Click on Forum, then Click on Email Status.<br>";
$body .= "This will update your account to <i>Passive</i>. You will still be able to view the forums by logging on to the website.com Website.";
$body .= "<br><br>Sincerely, <br>";
$body .= "website";
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["fname"] . ", \n\n";
$text_body .= "$poster has submitted a reply to the Forum. \n\n Topic:".$topicheader." \n";
$text_body .= $topic_text."\n\nTheir Reply:\n";
$text_body .= $message;
$text_body .= "\n\n\n If you would like to reply to this message, Login to the <a href=\"
http://www.website.com/login.php\" target=\"blank\">website Members</a> section.\n\nIf you no longer wish to receive emails generated from the Forum, Login to your account, Click on Forum, then Click on Email Status.\n";
$yext_body .= "This will update your account to Passive. You will still be able to view the forums by logging on to the Website.";
$text_body .= "\n\n Sincerely, \n";
$text_body .= "me";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["em
ailaddress
"], $row["fname"]);
//$mail->AddStringAttachme
nt($row["p
hoto"], "YourPhoto.jpg");
//$mail->Send();
if(!$mail->Send()){
$error++;
//creates and logs errors
$myFile = "nosendreply.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = $row["emailaddress"]." | ";
fwrite($fh, $stringData);
fclose($fh);
}
//else{$emailssent++;echo $emailssent."to".$row['ema
iladdress'
].",";}
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}
}
else{ echo"Something went wrong";//print_r($ref);
}
header(sprintf("Location: %s", $GoTo."?errors=$error"));
?>
Start Free Trial