-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.php
37 lines (30 loc) · 1.08 KB
/
feedback.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require 'C:\\xampp\\htdocs\\WEB\\vendor\\autoload.php'; // Include the Composer autoloader
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
// Include the database connection settings
include('config.php');
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
// Add your email address where you want to receive messages
$to = "[email protected]";
$email_subject = "New Feedback Form Submission: $subject";
$headers = "From: $email";
// Construct the email message
$email_message = "Name: $name\n";
$email_message .= "Email: $email\n";
$email_message .= "Subject: $subject\n\n";
$email_message .= "Message:\n$message";
// Send the email
if (mail($to, $email_subject, $email_message, $headers)) {
echo "Your message has been sent successfully!";
} else {
echo "Oops! Something went wrong. Please try again later.";
}
}
?>