Use the `email` field to check for form submission, see #3144

This commit is contained in:
Marcus Bointon 2025-03-04 19:11:22 +01:00
parent ac30223de5
commit ab8d4f87a4
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
if (array_key_exists('to', $_POST)) {
if (array_key_exists('email', $_POST)) {
$err = false;
$msg = '';
$email = '';
@ -45,7 +45,7 @@ if (array_key_exists('to', $_POST)) {
$to = 'support@example.com';
}
//Make sure the address they provided is valid before trying to use it
if (array_key_exists('email', $_POST) && PHPMailer::validateAddress($_POST['email'])) {
if (PHPMailer::validateAddress($_POST['email'])) {
$email = $_POST['email'];
} else {
$msg .= 'Error: invalid email address provided';
@ -99,4 +99,4 @@ if (array_key_exists('to', $_POST)) {
echo $msg;
} ?>
</body>
</html>
</html>