One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
147.79.69.25
Server :
Linux in-mum-web1837.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
u322583024
/
domains
/
jimmy2chs.in
/
public_html
/
View File Name :
send-mail.php
<?php include('connection.inc.php'); header('Content-Type: application/json'); // Set the correct content type for JSON ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Default response $response = array( 'status' => 0, 'message' => 'Form submission failed, please try again.' ); try { // Check if the form fields are set and not empty if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['phone']) && !empty($_POST['msg'])) { // Get the submitted form data $name = mysqli_real_escape_string($con, $_POST['name']); $email = mysqli_real_escape_string($con, $_POST['email']); $phone = mysqli_real_escape_string($con, $_POST['phone']); $msg = mysqli_real_escape_string($con, $_POST['msg']); $added_on = date('Y-m-d h:i:s'); // Insert into database $sql = "INSERT INTO contact (name, email, phone, msg, added_on) VALUES ('$name', '$email', '$phone', '$msg', '$added_on');"; if (mysqli_query($con, $sql)) { // Prepare and send the email $html = "<table> <tr><td>Name:</td><td>$name</td></tr> <tr><td>Email:</td><td>$email</td></tr> <tr><td>Phone:</td><td>$phone</td></tr> <tr><td>Message:</td><td>$msg</td></tr> </table>"; // Include PHPMailer library include('smtp/PHPMailerAutoload.php'); $mail = new PHPMailer(true); // SMTP settings $mail->isSMTP(); $mail->Host = "smtp.gmail.com"; $mail->Port = 587; // Use 587 for TLS $mail->SMTPSecure = "tls"; // Encryption protocol $mail->SMTPAuth = true; $mail->Username = "hsdigital30@gmail.com"; // Your Gmail account $mail->Password = "kyok agvi pcrv wjce"; // Replace with the generated app-specific password $mail->setFrom("hsdigital30@gmail.com", "Your Name or Company"); // Sender email and name $mail->addAddress("hsdigital30@gmail.com"); // Recipient email // Email settings $mail->IsHTML(true); $mail->Subject = "New Contact Us Submission"; $mail->Body = $html; // Attempt to send the email if ($mail->send()) { $response['status'] = 1; $response['message'] = 'Form data submitted successfully!'; } else { $response['message'] = 'Mail sending failed: ' . $mail->ErrorInfo; } } else { $response['message'] = 'Database insertion failed: ' . mysqli_error($con); } } else { $response['message'] = 'All fields are required.'; } } catch (Exception $e) { $response['message'] = 'An error occurred: ' . $e->getMessage(); } echo json_encode($response); ?>