Skip to content

Commit

Permalink
Update manage-contact-queries-send-reply.php
Browse files Browse the repository at this point in the history
removed email information
  • Loading branch information
chetanganeshi authored May 1, 2021
1 parent e2a394c commit d952b23
Showing 1 changed file with 9 additions and 62 deletions.
71 changes: 9 additions & 62 deletions account/configure-site/manage-contact-queries-send-reply.php
Original file line number Diff line number Diff line change
@@ -1,70 +1,17 @@
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require '../../PHPMailer/src/Exception.php';
require '../../PHPMailer/src/PHPMailer.php';
require '../../PHPMailer/src/SMTP.php';

include '../../connection.php';


$id = $_REQUEST['id'];


$get = mysqli_query($conn,"SELECT * FROM contactus WHERE id='$id'");
while($row = mysqli_fetch_array($get))
{
$uname=$row['uname'];
$emailid=$row['emailid'];
$subject ="Reply from AASC to your Contacted Query";
$reply="Hello <b>" .$uname.", </b> <br><br> <b>Requested Query: ".$row['msg']."</b> <br><br> <b>Reply: </b>".$row['reply'];
}



// Load Composer's autoloader
require '../../../../phpMyAdmin/vendor/autoload.php';

// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);

try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
$mail->isSMTP(); // Send using SMTP
$mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'jaihind123'; // SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = 587; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

//Recipients
$mail->setFrom('[email protected]', 'Admin-AASC');
$mail->addAddress($emailid, $uname); // Add a recipient
//$mail->addAddress('[email protected]'); // Name is optional
$mail->addReplyTo('[email protected]', 'Admin-AASC');
//$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');

// Attachments
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name

// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $reply;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

$mail->send();

echo '<script> alert("Message has been sent!")</script>';

} catch (Exception $e) {
echo '<script> alert("Message could not be sent. Error: <!--{$mail->ErrorInfo}-->")</script>';
}
$get = mysqli_query($conn,"SELECT * FROM contactus WHERE id='$id'");
while($row = mysqli_fetch_array($get))
{
$uname=$row['uname'];
$emailid=$row['emailid'];
$subject ="Reply from AASC to your Contacted Query";
$reply="Hello <b>" .$uname.", </b> <br><br> <b>Requested Query: ".$row['msg']."</b> <br><br> <b>Reply: </b>".$row['reply'];
}

?>
?>

0 comments on commit d952b23

Please sign in to comment.