title: Send HTML form data to Gmail account
body: <p>I'm setting up a website that has about 6 different HTML forms. I would like the data that people put into the form be sent to my gmail account. My web host is godaddy and I already had set up email forwarding with godaddy, but I haven't received them email when I uploaded the website files and tested the forms when the website was live.</p>
  <p>I also changed the file extension from .html to .php to include the php code. However, in the end I didn't get an email. Additionally, I was reading about PHPMailer and Composer, but it seems all so complex, which shouldn't be if I set up email forwarding with godaddy for the gmail account.</p>
  <p>NB: I'm extremely new to PHP</p>
  <p>HTML Code:</p>
  <pre><code>        &lt;div class=&quot;container&quot;&gt;
          &lt;div class=&quot;formBx&quot;&gt;
              &lt;form&gt;
                  &lt;h2&gt;Door to Door Inquiry&lt;/h2&gt;
                  &lt;div class=&quot;inputBox&quot;&gt;
                      &lt;input type=&quot;text&quot; name=&quot;name&quot; required=&quot;required&quot;&gt;
                      &lt;span&gt;Full Name&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;inputBox&quot;&gt;
                      &lt;input type=&quot;text&quot; name=&quot;mail&quot; required=&quot;required&quot;&gt;
                      &lt;span&gt;Email Address&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;inputBox&quot;&gt;
                      &lt;input type=&quot;text&quot; name=&quot;phone&quot; required=&quot;required&quot;&gt;
                      &lt;span&gt;Phone Number&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;inputBox&quot;&gt;
                      &lt;textarea type=&quot;text&quot; name=&quot;message&quot; required=&quot;required&quot;&gt;&lt;/textarea&gt;
                      &lt;span&gt;Type Your Message Here...&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;inputBox&quot;&gt;
                      &lt;input type=&quot;submit&quot; value=&quot;Send&quot; name=&quot;&quot;&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
              &lt;div class=&quot;imgBx&quot;&gt;
                 &lt;img src=&quot;images/door-door-delivery-service_82574-7443.jpg&quot; alt=&quot;Picture of yellow, cartoon SUV.&quot;&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/section&gt;
  </code></pre>
  <p>PHP Code:</p>
  <pre><code>    if(isset($_POST['submit'])) {
  
      $name = $_POST['name'];
      $email = $_POST['email'];
      $phone = $_POST['phone'];
      $message = $_POST['message'];
  
      $to = &quot;sitenameinfo@sitename.com&quot;;
      $subject = &quot;Site contact form&quot;;
  
      $header = &quot;From: &quot;.$email.&quot;\r\n&quot;;
      $header .= &quot;Cc: &quot;.$email.&quot;\n&quot;;
      $header .= &quot;Reply-To : &quot;.$email.&quot;\r\n&quot;;
      $header .= &quot;Return-Path : &quot;.$email.&quot;\r\n&quot;;
      $header .= &quot;X-Mailer: PHP\r\n&quot;;
      $header .= &quot;MIME-Version: 1.0\r\n&quot;;
      $header .= &quot;Content-Type: text/plain; charset=iso-8859-1\r\n&quot;;
  
      if(mail($to, $subject, $message, $header))
      {
        echo &quot;Mail Sent Successfully&quot;;
      }else{
        echo &quot;Mail Not Sent&quot;;
      }
  
      }
      ?&gt;
  </code></pre>