title: Send Mail on successful registration
body: <p>I'm trying to code a script in order to mail the user upon his/her successful registration using PHP.
  The user gets registered successful in the database, though the email is not being sent.
  Here is my code:</p>
  
  <pre><code>&lt;?php
  function send_mail($id,$name,$email,$password)
  {   
      $from='Admin &lt;admin@mydomain.com&gt;';
      $headers = '';
      $headers .= "From: $from\n";
      $headers .= "Reply-to: $from\n";
      $headers .= "Return-Path: $from\n";
      $headers .= "Message-ID: &lt;" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . "&gt;\n";
      $headers .= "Date: " . date('r', time()) . "\n";
      $headers .= "MIME-Version: 1.0" . "\r\n";
      $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
  
  }
  $subject = "Welcome!";
  $message = "
  &lt;p&gt;&lt;/p&gt;&lt;br&gt;
  Hi ".$name."&lt;br&gt;
  Thank you for registering for the event.&lt;br&gt;&lt;br&gt;
  Your ID is ".$id."&lt;br&gt;
  Login using your email id : ".$email." and,&lt;br&gt;
  your password : ".$password."&lt;br&gt;&lt;br&gt;
  ";
  
  
  mail($email,$subject,$message,$headers);
  ?&gt;
  </code></pre>
  
  <p>In my <code>register.php</code> script I've included:</p>
  
  <pre><code>send_mail($u_id,$u_name,$_POST['email'],$password)
  </code></pre>
  
  <p>The parameters of the function are <code>id</code> (INT), <code>name</code> (VARCHAR), <code>email</code> (VARCHAR) &amp; <code>password</code> (VARCHAR)</p>