john666 Posted January 28, 2014 Share Posted January 28, 2014 i m unable to send mail using php where is problem while i have tried all other methods too but mail not receiving in my inbox..tried other id,s n diffrente codes too here is my code Form.... <html> <body> <form method="POST" action="mail.php"> First Name <input type="text" name="firstname" > Last Name <input type="text" name="lastname" > Email <input type="text" name="email" > <textarea rows="6" cols="10" name="message" ></textarea> <input type="submit" name="submit" value="Send Mail"> </form> </body> </html> PHP Code <?php $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $email=$email['email']; $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; mail($to,$subject,$message,$email,"From:".$firstname . $lastname); echo "Mail Sent SuccessFully."; ?> Link to comment https://forums.phpfreaks.com/topic/285749-mail-problem/ Share on other sites More sharing options...
ginerjm Posted January 28, 2014 Share Posted January 28, 2014 You are not checking the result of your call to the mail function. Why? Also - what is the contents of your $email array? You don't show us. Hopefully it is a properly formed return address unlike your "additional parameter" that you have included. You should read up on the mail function in the php manual. Link to comment https://forums.phpfreaks.com/topic/285749-mail-problem/#findComment-1466875 Share on other sites More sharing options...
john666 Posted January 29, 2014 Author Share Posted January 29, 2014 You are not checking the result of your call to the mail function. Why? Also - what is the contents of your $email array? You don't show us. Hopefully it is a properly formed return address unlike your "additional parameter" that you have included. You should read up on the mail function in the php manual. i have checked result to ..Mail return true.. and in email array its has sender email id and i have sent short format too like mail($to,$subject,$message) but not receiving any thing in email and nor error on page Link to comment https://forums.phpfreaks.com/topic/285749-mail-problem/#findComment-1466912 Share on other sites More sharing options...
ginerjm Posted January 29, 2014 Share Posted January 29, 2014 You have to have the necessary header in the mail() call. Read the section in the manual - it will tell you what you are missing. Just because you have checked the result of the call to mail once doesn't mean it can't happen at any point in the future. Put the check of the result back into your code. Link to comment https://forums.phpfreaks.com/topic/285749-mail-problem/#findComment-1466943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.