breaking262 Posted March 22, 2017 Share Posted March 22, 2017 Hey guys, i'm quite new to php and my mail function wont work and i don't know why... <?php //if "email" variable is filled out, send email if (isset($_REQUEST['email'])) { //Email information $admin_email = "example@mail.com"; $name = $_REQUEST['email']; $email = $_REQUEST['email']; $date = $_REQUEST['date']; $uur = $_REQUEST['uur']; $behandeling = $_REQUEST['behandeling']; $comment = $date ."\r\n"; $comment .= $uur ."\r\n"; $comment .= $behandeling ."\r\n"; $comment .= $name; //send email mail($admin_email, "afspraak", $comment, "From:" . $email); //Email response echo "Bedankt voor uw afspraak!"; } //if "email" variable is not filled out, display the form else { ?> <form method="post"> <input name="email" type="email" placeholder="email@adress.com" required/> <input type="text" name="name" placeholder="Voornaam Naam" required></input> <input type="text" name="date" placeholder="Datum: DD/MM/JJJJ" required></input> <input type="text" name="uur" placeholder="jouw beschikbaarheid, bvb: '14:00 - 16:00'" required></input> <input type="text" name="behandeling" placeholder="Behandeling, bvb: Pedicure en manicure" required></input> <span>Vermeld de gewenste datum, het gewenste uur <br>en de behandeling a.u.b. <br>Hou na de e-mail je mailbox in de gaten voor een antwoord.</span><br><br> <input type="submit" class="myButton" value="Verzend" /> </form> <?php } ?> Quote Link to comment Share on other sites More sharing options...
benanamen Posted March 22, 2017 Share Posted March 22, 2017 (edited) You have several problems. For one, the from is not the email in the form, it is the server sending the email. You have variables for nothing and the code is vulnerable to a header injection and you should be using POST, not REQUEST. Edited March 22, 2017 by benanamen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.