note 110999 added to function.mail

From: Date: Fri, 04 Jan 2013 11:28:15 +0000
Subject: note 110999 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-192758@lists.php.net to get a copy of this message
I have written the following php code, the code is executing correctly fine but i cant receiving any mail. please help me to resolve the problem, thanks in advance. <?php if(!isset($_POST['submit'])) { //This page should not be accessed directly. Need to submit the form. echo "error; you need to submit the form!"; } $name = $_POST['name']; $visitor_email = $_POST['email']; $message = $_POST['message']; //Validate first if(empty($name)||empty($visitor_email)) { echo "Name and email are mandatory!"; exit; } if(IsInjected($visitor_email)) { echo "Bad email value!"; exit; } $email_from = 'ramadugu.sumanth@gmail.com';//<== update the email address $email_subject = "New Form submission"; $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message". $to = 'ramadugu.sumanth@gmail.com';//<== update the email address $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; //Send the email! mail($to,$email_subject,$email_body,$headers); //done. redirect to thank-you page. header('Location: thank-you.html'); // Function to validate against any email injection attempts function IsInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } ?> ---- Server IP: 69.147.83.199 Probable Submitter: 112.79.41.136 ---- Manual Page -- http://php.net/manual/en/function.mail.php Edit -- https://master.php.net/note/edit/110999 Del: integrated -- https://master.php.net/note/delete/110999/integrated Del: useless -- https://master.php.net/note/delete/110999/useless Del: bad code -- https://master.php.net/note/delete/110999/bad+code Del: spam -- https://master.php.net/note/delete/110999/spam Del: non-english -- https://master.php.net/note/delete/110999/non-english Del: in docs -- https://master.php.net/note/delete/110999/in+docs Del: other reasons-- https://master.php.net/note/delete/110999 Reject -- https://master.php.net/note/reject/110999 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192758) next »