4554551n Posted June 28, 2010 Share Posted June 28, 2010 Hello, I have a problem with my mailform.php cause I don't receive any emails... I don't know what to do, what exactly should I change? Can someone help me? Please note that I've changed real email address into this [email protected] <?php function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input"; } else {//send email $name = $_REQUEST['name']; $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("[email protected]", "Subject: $subject", $message, "From: $email" ); echo "Mail sent"; ?> <meta http-equiv="REFRESH" content="3;url=index.html"> <?php } } else { echo 'Error, try again.'; ?> <meta http-equiv="REFRESH" content="3;url=index_6.html"> <?php } ?> And here is my html code <form action="../mailform.php" method="post"> <p>Name: <br /></p> <p><input type="text" name="name" size="30" /></p> <p>Email:<br /></p> <p><input type="text" name="email" size="30" /></p> <p>Subject:<br /></p> <p><input type="text" name="subject" size="30" /></p> <p>Message:<br /></p> <p><textarea cols="50" rows="10" name="message"></textarea></p> <p><input type="submit" value=" Send " /></p> </form> Thank you. Link to comment https://forums.phpfreaks.com/topic/206083-contact-form-doesnt-work-well/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 28, 2010 Share Posted June 28, 2010 The From: email address must be a valid mail box at the sending mail server. You are putting the visitors entered email in as the From: address. Put a valid email box at the sending mail server in as the From: address and put the visitors entered email address in as a Reply-to: address. Link to comment https://forums.phpfreaks.com/topic/206083-contact-form-doesnt-work-well/#findComment-1078319 Share on other sites More sharing options...
4554551n Posted June 29, 2010 Author Share Posted June 29, 2010 You are telling me to change this $name = $_REQUEST['name']; $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("[email protected]", "Subject: $subject", $message, "From: $email" ); into $name = $_REQUEST['name']; $email = $_REQUEST['email'] ; $reply-to = $_REQUEST['reply-to'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("[email protected]", "Subject: $subject", $message, "From: $email", "Reply-to: $reply-to" ); What do u mean by "put valid email box"? Link to comment https://forums.phpfreaks.com/topic/206083-contact-form-doesnt-work-well/#findComment-1078670 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.