Do not close this page untill you see the message all mails have been sent

0) { echo "
The email address you are sending from is not valid"; $perror=1; } else { $row=mysql_fetch_array($result); $mfrom=$row['username']; $pass=$row['passwd']; } } if (!$perror==1) { $dbhost = 'localhost'; $dbuser = 'auspat'; $dbpass = 'kimwick'; $dbname = 'swanmail'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting'); mysql_select_db($dbname); //$sql=("SELECT email FROM maildb"); //$result=mysql_query($sql); //$errors="The following email address's are not valid. Please remove them."; // while ($row=mysql_fetch_array($result)) { // $mto=$row['email']; // echo "".$mto."
"; // if (!preg_match("/^([a-zA-Z0-9])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/", $mto)) { // $errors=$errors . "
The email address " . $mto . " is not valid"; // $perror=1; // } // } } if ($perror==1) { echo $errors; } if (!$perror==1) { $filename = $_POST['filename']; //this is the filename input of your form $limit_size=2000000; //if ($_FILES['filename']['size']>1000000) //echo "To Large"; //} $file = basename($_FILES['filename']['name']); if($file>'') { $file_size=$HTTP_POST_FILES['filename']['size']; if($file_size >= $limit_size){ echo "
You file is over the 2MB limit!"; $perror=1; } $uploaddir = 'uploads/'; //where you want the file to go $file = stripslashes($file); // Check file extension $allowed_filetypes = array('.txt','.csv','.htm','.html','.xml','.css','.doc','.xls','.rtf','.pdf','.jpg','.jpeg','.gif','.png'); $ext = substr($file, strpos($file,'.'), strlen($file)-1); if(in_array($ext,$allowed_filetypes)){ } else { echo "
You may only send the following file extensions - txt, csv, htm, html, xml, css, doc, xls, rtf, pdf, jpg, jpeg, gif, png"; $perror=1; } ////////////////// $uploadfile = $uploaddir . $file; //the move_uploaded_file() function is what moves the temp working file to it's final location. if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { // echo "
"; 
// echo "Successfully Uploaded: $file...\n"; 
		//$mail->AddAttachment('uploads/' . $file);
		$myfile=1;
		} else { 
//$perror="Your email was sent but the file attachment failed.";
//header("location:" . $retpage . "?perror=" . $perror);
echo "
"; 
 echo "upload failed!\n"; 
 echo 'Here is some more info on your upload:'; 
 print_r($file); 
 echo "
"; $perror=1; } } } if (!$perror==1) { $subject=$_REQUEST['subject']; $body1=str_replace("\n","
",$_REQUEST['body']); $body = ""; $body .= ""; $body .='
" . $body1 . "




To view the message, please use an HTML compatible email viewer!'; $result=mysql_query("SELECT email FROM maildb WHERE status=0"); while ($row=mysql_fetch_array($result)) { $mto=$row['email']; $pmail=$row['email']; require_once('class.phpmailer.php'); $mail = new PHPMailer(true); $mail->IsHTML(true); $mail->IsSMTP(); $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mail.palmsecure.biz"; // sets the SMTP server $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->AddAddress($mto); $mail->WordWrap = 150; $mto=$_POST['recipient']; $mail->Username = $mfrom; $mail->Password = $pass; // SMTP account password $mail->SetFrom($mfrom); $mail->Subject = $subject; $mail->MsgHTML($body) ; if ($myfile==1) { $mail->AddAttachment('uploads/' . $file); } mysql_query("UPDATE maildb SET status=1 WHERE email='$pmail'"); $mail->Send(); } mysql_query("UPDATE maildb SET status=0 WHERE status=1"); if ($myfile==1) { unlink('uploads/' . $file); } ?>

All mails have been sent