-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_email.php
More file actions
26 lines (23 loc) · 750 Bytes
/
send_email.php
File metadata and controls
26 lines (23 loc) · 750 Bytes
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
<?php
// Check if the form was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get form data
$name = htmlspecialchars($_POST['name']);
$email = htmlspecialchars($_POST['email']);
$message = htmlspecialchars($_POST['message']);
// Email details
$to = "louisflinn.work@gmail.com";
$subject = "New Contact Form Submission";
$body = "Name: $name\nEmail: $email\n\nMessage:\n$message";
// Headers
$headers = "From: $email";
// Send email
if (mail($to, $subject, $body, $headers)) {
echo "Thank you for getting in contact :)";
} else {
echo "Oops! Something went wrong, and your message wasn't sent.";
}
} else {
echo "Form submission failed. Please try again.";
}
?>