| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /software/Services/PHP/sendemails/ |
Upload File : |
<?php
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
//include "general.php";
include "../general.php";
include "../connect.php";
require 'vendor/autoload.php';
$noreplyto = "noreply@247sms.com";
//include 'newsendmail.php';
function mailtoclient ($clientEmail,$mess1,$mess2,$subj,$mfrom,$mfromname,$noreplyto){
//echo 'nosa';
$mail = new PHPMailer(true);
try {
//Server settings
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'email-smtp.us-east-1.amazonaws.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'AKIAUW4RAPR3HBRDPAED'; //SMTP username
$mail->Password = 'BOwfFxC25Q6GoghaUYOWoK/Y1mr0LKpZ6l7DUXnzdCYO'; //SMTP password
//$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom($mfrom, $mfromname);
//$mail->addAddress('joe@example.net', 'Joe User'); //Add a recipient
$mail->addAddress($clientEmail); //Name is optional
$mail->addReplyTo($noreplyto, $mfromname);
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subj;
$mail->Body = $mess1;
$mail->AltBody = $mess1;
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
//include "../sendmailclient.php";
date_default_timezone_set('Africa/Lagos');
$cnt = 1;
$cnt2=0;
//$mfrom = "info@chatme24.com";
//$mfromname = "Chatme24 Team";
while($cnt ==1){
$query= "SELECT sn,emailsubject,emailbody,mailfrom,fromname FROM emaildetails where status ='0' and sn=3 order by sn limit 1";
$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
return '#';
die();
}
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
if($row = mysqli_fetch_array($result)){
$sn = $row[0];
$subject = $row[1];
$emailbody = $row[2];
$mfrom = $row[3];
$mfromname = $row[4];
//$mfrom = "noreply@247sms.com";
//$mfromname = "247sms Team";
//$message = str_replace('^',"'",$message);
//echo "processing record" ."\n";
//echo "email ". $email."\n";
///echo "subject " .$subject ."\n";
//echo "body " .$emailbody ."\n";
//check for individual emails
//$query= "SELECT sn,email FROM emailrecipients where status ='0' order by sn";
//$query= "SELECT sn,email,username FROM userlogin where sn =140 order by sn";
//$query= "SELECT sn,email,username FROM userlogin where domain ='247sms.com' order by sn";
$query= "SELECT sn,email,username FROM userlogin17122021 where domain ='247sms.com' and sn > 26285 order by sn";
$con2=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
return '#';
die();
}
if(!$result2= mysqli_query($con2,$query))
{
mysqli_close($con2);
return "#";
}
else
{
while ($row2 = mysqli_fetch_array($result2))
{
$sn2 = $row2[0];
$email = $row2[1];
$username = $row2[2];
//$message = str_replace('^',"'",$message);
$emailbody = str_replace('#user#',$username,$emailbody);
echo "processing record" ."\n";
echo "email ". $email."\n";
echo "subject " .$subject ."\n";
echo "sn " .$sn2 ."\n";
//echo "body " .$emailbody ."\n";
//$email="jackson@tickwaves.co.uk";
//send email
//echo "nosa " .$mfrom ."\n";
$mymail = mailtoclient($email,$emailbody,$emailbody,$subject,$mfrom,$mfromname,$noreplyto);
//update the record
// $query = "update emaillastrecord set status ='$sn2'";
// $queryresponse = updateQuery($query);
$cnt2++;
echo "\nTotal email sents ... ".$cnt2 ."\n". date("Y-m-d h:i:s",time())."\n";
sleep(10);
}
}
// update the emaildetails
$query = "update emaildetails set status ='1' where sn = $sn ";
$queryresponse = updateQuery($query);
}
} //else
echo "\nTotal emails sent ****** ".$cnt2 ."\n". date("Y-m-d h:i:s",time())."\n";
sleep(0);
}//end main while
?>