66 lines
2.6 KiB
PHP
66 lines
2.6 KiB
PHP
<?php
|
|
|
|
/* $Id: help_contact.php 42 2009-01-29 04:55:14Z john $ */
|
|
include "../include/dbinclude.php";
|
|
use PHPMailer\PHPMailer\PHPMailer;
|
|
use PHPMailer\PHPMailer\Exception;
|
|
|
|
require '../include/phpmailer/src/Exception.php';
|
|
require '../include/phpmailer/src/PHPMailer.php';
|
|
require '../include/phpmailer/src/SMTP.php';
|
|
//$email = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_systememails WHERE systememail_name='{$systememail}' LIMIT 1"));
|
|
|
|
|
|
$mail = new PHPMailer;
|
|
$mail->isSMTP();
|
|
$mail->SMTPDebug = 2; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
|
|
$mail->Host = "mail.b8world.com"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
|
|
$mail->Port = 587; // TLS only
|
|
$mail->SMTPKeepAlive=true;
|
|
$mail->SMTPSecure = 'tls'; // ssl is depracated
|
|
$mail->SMTPAuth = true;
|
|
$mail->Username = "mailservices@b8world.com";
|
|
$mail->Password = "mAQquIkiZUzW";
|
|
$mail->SetFrom('mailservices@b8world.com', 'Bateworld');
|
|
$mail->AddReplyTo('wayne@bateworld.com', 'Bateworld');
|
|
$query=$database->database_query("SELECT * FROM emailstosend");
|
|
while($row=$database->database_fetch_array($query))
|
|
{
|
|
|
|
$chkemail = $database->database_fetch_assoc($database->database_query("SELECT admin_id FROM se_admins WHERE admin_email='{$row["email"]}' LIMIT 1"));
|
|
if($chkemail['admin_id']!=NULL){$emailaddressok=1;$chkemail['user_pdp_evc']=1;}else{
|
|
//$chkemail=0;
|
|
|
|
|
|
|
|
$chkemail = $database->database_fetch_assoc($database->database_query("SELECT user_pdp_evc, user_id FROM se_users WHERE user_email='{$row["email"]}' LIMIT 1"));
|
|
if($chkemail['user_pdp_evc']==null||$chkemail['user_pdp_evc']=="")
|
|
{
|
|
$chkemail = $database->database_fetch_assoc($database->database_query("SELECT user_pdp_evc, user_id FROM se_users WHERE user_newemail='{$row["email"]}' LIMIT 1"));
|
|
|
|
//$chkemail=0;
|
|
}
|
|
}
|
|
|
|
$emailaddressok=$chkemail['user_pdp_evc'];
|
|
$pdpuid=$chkemail['user_id'];
|
|
if($emailaddressok == 1 || $emailaddressok == 3 || $emailaddressok==5){
|
|
$mail->AddAddress($row["email"]);
|
|
$mail->Subject = $row["subject"];
|
|
$mail->msgHTML($row["message"]); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
|
|
//$mail->AltBody = 'HTML messaging not supported';
|
|
// $mail->addAttachment('images/phpmailer_mini.png'); //Attach an image file
|
|
echo "Start seconds: ".date("s")."<br>";
|
|
if(!$mail->send()){
|
|
echo "Mailer Error: " . $mail->ErrorInfo;
|
|
}else{
|
|
echo "Message sent!";
|
|
}
|
|
|
|
}
|
|
|
|
$mail->clearAllRecipients( );
|
|
$database->database_query("DELETE FROM emailstosend WHERE id='".$row["id"]."'");
|
|
}
|
|
exit;
|
|
?>
|