From 67e1f47fab4870d259e87358432f960b3f20c83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 9 Feb 2016 08:07:25 +0100 Subject: [PATCH] Fixed some mailsettings --- php/mail.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/php/mail.php b/php/mail.php index e29f87b1..85212c29 100644 --- a/php/mail.php +++ b/php/mail.php @@ -6,12 +6,16 @@ $message = htmlspecialchars($_POST['message']); $headers = "From: " . $from . "\r\n"; - $result = mail("contact@zoff.no", "Contact from form", $message, $headers); + if(filter_var($from, FILTER_VALIDATE_EMAIL) && $message != ""){ + $result = mail("contact@zoff.no", "Contact from form", $message, $headers); - if($result == FALSE){ - echo "failure"; + if($result == FALSE){ + echo "failure"; + }else{ + echo "success"; + } }else{ - echo "success"; + echo "failure"; } }