Server : LiteSpeed System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u615232177 ( 615232177) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/u615232177/domains/adesmiley.com/public_html/admin41345/ |
<?php use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use PHPMailer\PHPMailer\SMTP; session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<title><?php echo $company_name; ?>, Admin, Emails</title>
<?php
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/Exception.php';
$mail = new PHPMailer();
if (isset($_POST["send_emails"])) {
$subject = mysqli_real_escape_string($con,$_POST['subject']);
$unformatted_email = mysqli_real_escape_string($con,$_POST['email']);
$message1 = mysqli_real_escape_string($con,$_POST['message']);
$unformatted_email1 = trim($unformatted_email);
$email = rtrim($unformatted_email1, ',');
$emails = array();
$result = array();
//seperate them via loop and send each
$emails = explode(",",$email);
foreach($emails as $one_email){
/*
$stmt = $con -> prepare('SELECT first_name,last_name FROM users WHERE email =?');
$stmt -> bind_param('s', $one_email);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($first_name,$last_name);
$numrows = $stmt -> num_rows();
if($numrows > 0){
while ($stmt -> fetch()) {}
}
else{$first_name="User";$last_name="";}
*/
$first_name="User";
$last_name="";
$msg = '';
$message="";
$button_link="$link";
$button_text="Visit";
$email_topic="$subject";
include("email_header.php");
$message .= "
Dear $first_name,<br/><br/>
$message1
<br><br>
If you have any questions please contact our dedicated support staff at $company_email<br/><br/>
The $company_name Team.<br/><br/>
$email_logo<br/><br/>
";
include("email_footer.php");
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from address
$mail->AddReplyTo("$company_email", "$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject";
$mail->MsgHTML("<html><body>$message<br></body></html>");
$mail->AddAddress("$email", "$email");//Send the message to yourself, or whoever should receive contact for submissions
//$mail->AddAttachment(""); // attachment
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
$result[] ="Email to $one_email ($first_name $last_name) <span style='color:red;'>NOT</span> sent<br/>";
$msg = "<div class='alert alert-danger'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Something went wrong, please try again</b>
$mail->ErrorInfo
</div>";
}
else {
$result[] ="Email to $one_email ($first_name $last_name) <span style='color:green;'>successfully</span> sent<br/>";
$msg = "<div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Email Sent</b>
</div>";
}
}
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container"> </div>
</section>
<!-- End Breadcrumbs -->
<!-- ======= Contact Section ======= -->
<section id="contact" class="contact inner-page">
<div class="container" data-aos="fade-up">
<div class="section-title">
<h2>Send Emails</h2>
<p>Hosting allows only 50 emails per HOUR. So the emails of users are automatically grouped below into groups of 50 or less so that emails can be copied and pasted into the form and then sent in batches without exceeding the email quota.</p>
</div>
<div class="row">
<div class="col-md-12 col-lg-12 mb-4 mb-lg-0">
<?php
if(isset($_POST['send_emails'])) {
$count_result=0;
foreach ($result as $value) {
$count_result++;
echo"$count_result - $value";
}
}
?>
</div>
<div class="col-lg-6" style='display:inline;overflow-wrap:break-word;'><hr>
<?php $count=0;
$stmt = $con -> prepare('SELECT email FROM email_subscribers');
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($email);
$numrows = $stmt -> num_rows();
if($numrows > 0){
while ($stmt -> fetch()) {
$count++;
echo"$email,";
if($count == 50 OR $count == 100 OR $count == 150 OR $count == 200 OR $count == 250 OR $count == 300 OR $count == 350 OR $count == 400 OR $count == 450 OR $count == 500 OR $count == 550 OR $count == 600 OR $count == 650 OR $count == 700 OR $count == 750 OR $count == 800 OR $count == 850 OR $count == 900 OR $count == 950 OR $count == 1000 OR $count == 1050 OR $count == 1100){echo"<div style='height:50px;'><hr></div>";}
}
}
?>
</div>
<div class="col-lg-6 mt-5 mt-lg-0 d-flex align-items-stretch">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" class="php-email-form1" enctype='multipart/form-data'>
<div class='validate'><?php echo $error; ?></div>
<div class="form-row">
<div class="form-group col-md-12">
<input type='text' name='subject' placeholder='Subject' class="form-control" required />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<textarea name='email' placeholder='Emails(CSV)' class="form-control" required></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<textarea name='message' placeholder='Email Content' class="form-control" required></textarea>
</div>
</div>
<div class="text-center">
<button type="submit" name='send_emails'>SEND EMAILS</button>
</div>
</form>
</div>
</div>
</div>
</section><!-- End Contact Section -->
<?php include("footer.php"); ?>