john666 Posted January 28, 2014 Share Posted January 28, 2014 (edited) 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 = "john1990@gmail.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; mail($to,$subject,$message,$email,"From:".$firstname . $lastname); echo "Mail Sent SuccessFully."; ?> Edited January 28, 2014 by john666 Quote 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 (edited) 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. Edited January 28, 2014 by ginerjm Quote 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 (edited) 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 Edited January 29, 2014 by john666 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/285749-mail-problem/#findComment-1466943 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.