Skip to content

Commit

Permalink
Add 400 responses
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed Sep 5, 2024
1 parent 9b84b54 commit 41aa4f0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions public/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
if (mail($recipient, $subject, $message)) {
echo "Email sent successfully!";
} else {
header("HTTP/1.1 400 Bad Request");
echo "Failed to send email. Please try again later.";
}
} else {
// Display errors
header("HTTP/1.1 400 Bad Request");
echo "The form contains the following errors:<br>";
foreach ($errors as $error) {
echo "- $error<br>";
Expand Down

0 comments on commit 41aa4f0

Please sign in to comment.