在php中发送电子邮件,标题问题

I trying to send email using mail() function... here is my code:

     <html>
     <form action ="" method ="post">
     <input type="submit" name= "email" value="email">
     <form>

     <?php

     if (isset($_POST['email']))
     {

     mail("receiver@hotmail.com", "Subject: Hi", "hello" );

     echo "Mail Sent";
     }
     ?> 
     </html>

the code about works just fine, I can get the email but the only problem was when I check the email, the sender will be "webmaster@something.org"

I tried to change the code to:

     mail("receiver@hotmail.com", "Subject: Hi","hello", "From: sender@yahoo.com"  );

but it didn't work... Could you please help me to include the name of the person who sent the email... Thank a lot

Please try this.It is the simplest method to mail someone.

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "
" .
    'Reply-To: webmaster@example.com' . "
" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

Check php mail manual. You need to define 'From: xxx' in the header

check your form tag closed or not?

<?php
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

Use [phpmailer to send the mail.

You can set the sender id and content type for the mail.