Jump to content

Mail problem


john666

Recommended Posts

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 by john666
Link to comment
Share on other sites

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 by ginerjm
Link to comment
Share on other sites

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 by john666
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.