title: Beginner PHP: Mail() Function not Working
body: <p>I am new to php so please bear with me. I have created a registration for a test website which I am creating. The website collects user information and then sends a confirmation email. So far, no email has arrived after several attempts. I have tried the spam folder, yet to no avail.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>$to = "$email";
      // Change this to your site admin email
      $from = "someperson@gmail.com";
      $subject = "Complete your registration";
      //Begin HTML Email Message where you need to change the activation URL inside
      $message = '&lt;html&gt;
      &lt;body bgcolor="#FFFFFF"&gt;
      Hi ' . $username . ',
      &lt;br /&gt;&lt;br /&gt;
      You must complete this step to activate your account with us.
      &lt;br /&gt;&lt;br /&gt;
      Please click here to activate now &amp;gt;&amp;gt;
      &lt;a href="http://testw.freevar.com/activation.php?id=' . $id . '"&gt;
      ACTIVATE NOW&lt;/a&gt;
      &lt;br /&gt;&lt;br /&gt;
      Your Login Data is as follows: 
      &lt;br /&gt;&lt;br /&gt;
      E-mail Address: ' . $email . ' &lt;br /&gt;
      Password: ' . $password . ' 
      &lt;br /&gt;&lt;br /&gt; 
      Thanks! 
      &lt;/body&gt;
      &lt;/html&gt;';
      // end of message
      $headers = "From: $from\r\n";
      $headers .= "Content-type: text/html\r\n";
      $to = "$to";
      // Finally send the activation email to the member
      mail($to, $subject, $message, $headers,-f $from);
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>P.S. I have read online about a php.ini folder. I am creating a website from scratch and do not know what this is or if its necessary. Also, I am using a free hosting service which does not have an email address. I am not sure if this affects it.</p>