title: Sending mail with PHP's "mail()" function (without being in localhost)
body: <p>I have an issue with <strong>PHP's mail() function</strong>. I'm not on the localhost, I'm not using a local server or something of this kind.</p>
  <p>I'm just doing a <strong>plain website</strong> with HTML/CSS and I'm on Windows.</p>
  <p>Basically, I made a <strong>contact form</strong> in HTML and I want it to <strong>send me an email</strong> on my Gmail address with the information filled by the user. I have re-used an old piece of PHP code that I already used before and that worked (one year ago).</p>
  <p>However, when I fill the form and submit it (with the code below), I get <strong>nothing in my inbox</strong>.</p>
  <p>Moreover, when I click on the send button (&quot;J'envoie!&quot;), it <strong>redirects me to the contactform.php</strong> file (a blank page where I see the php code of this file).</p>
  <p>I checked that it was the right address, check if the name (&quot;UName1&quot;, &quot;UName2&quot;, &quot;btn-send&quot;) matched the names I put in the PHP file but still, I can't find where is my error...</p>
  <p><strong>Can you please help me with that? I have no clue where the error is...</strong></p>
  <p>So here are my 2 files:</p>
  <ul>
  <li><strong>submit.html</strong> (the form part only)</li>
  </ul>
  <pre class="lang-html prettyprint-override"><code>&lt;form class=&quot;part&quot; action=&quot;contactform.php&quot; method=&quot;post&quot;&gt;
  
  &lt;br&gt;
  
  &lt;div class=&quot;input-wrapper&quot;&gt;
      &lt;input type=&quot;text&quot; name=&quot;UName1&quot; placeholder=&quot;Mon nom&quot;&gt;&lt;/input&gt;
  &lt;/div&gt;
  
  &lt;br&gt;&lt;br&gt;
  
  &lt;div class=&quot;input-wrapper&quot;&gt;
      &lt;input type=&quot;text&quot; name=&quot;UName2&quot; placeholder=&quot;Le titre de mes notes&quot;&gt;&lt;/input&gt;
  &lt;/div&gt;
  
  &lt;br&gt;&lt;br&gt;
  
  &lt;a href=&quot;arigato.html&quot; style=&quot;text-decoration: none;&quot;&gt;
  &lt;button type=&quot;submit&quot; name=&quot;btn-send&quot; class=&quot;input-wrapper2&quot;&gt;J'envoie!&lt;/button&gt;     
  &lt;/a&gt;
  
  &lt;/form&gt;
  </code></pre>
  <ul>
  <li><strong>contactform.php</strong></li>
  </ul>
  <pre class="lang-php prettyprint-override"><code>&lt;?php 
  
      if(isset($_POST['btn-send']))
      {
         $UserName = $_POST['UName1'];
         $UserAccount = $_POST['UName2'];
         
         
  
         if(empty($UserName) || empty($UserAccount))
         {
             header('location:submit.html?error');
         }
         else
         {
             $to = &quot;santoshpassoubady@gmail.com&quot;;
  
             if(mail($to,$UserName,$UserAccount))
             {
                 header(&quot;location:submit.html?success&quot;);
             }
         }
      }
      else
      {
          header(&quot;location:submit.html&quot;);
      }
  ?&gt;
  </code></pre>
  <p>Please tell, if there is any other thing information I should give!</p>