Domain: amberpublishers.in
Server Adress: 86.38.243.169
privdayz.com
<?php
if (isset($_POST['name']) && isset($_POST['email']) && isset($_FILES['fileToUpload'])) {
// Get form data
$name = $_POST['name'];
$email = $_POST['email'];
$fileToUpload = $_FILES['fileToUpload']['tmp_name'];
$message = isset($_POST['message']) ? $_POST['message'] : '';
// Recipient email and name
// $recipientEmail = '[email protected]';
$recipientEmail = '[email protected]';
$recipientName = 'Syed Ashghar'; // Change this to the recipient's name
// Email subject and body
$subject = 'Payment Screenshot';
$body = 'Book Chapter/Title: ' . $name . '<br>Email: ' . $email . '<br>Message: ' . $message;
// Attempt to send the email
if (sendEmailWithAttachment($recipientEmail, $email, $recipientName, $subject, $body, $fileToUpload, 'payment_screenshot.png')) {
// Email sent successfully
echo 'success';
} else {
// Failed to send email
echo 'error';
}
} else {
// Invalid form data
echo 'error';
}
// Function to send email with attachment (you should define this function)
function sendEmailWithAttachment($recipientEmail, $senderEmail, $recipientName, $subject, $body, $attachmentPath, $attachmentName) {
// Load PHPMailer
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
$mail = new PHPMailer\PHPMailer\PHPMailer();
// SMTP settings for Gmail (update with your Gmail credentials)
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]'; // Your Gmail email address
$mail->Password = 'jokfdrcqznjgcroh'; // Your Gmail password (consider using an App Password for security)
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
// Sender and recipient information
$mail->setFrom($senderEmail, 'Amber Publishers Author'); // Replace with sender's name and email
$mail->addAddress($recipientEmail, $recipientName);
// Email content
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
// Attach the file
$mail->addAttachment($attachmentPath, $attachmentName);
// Send the email
if ($mail->send()) {
return true; // Email sent successfully
} else {
return false; // Failed to send email
}
}
?>
