title: send Gmail from php form
body: <p>I have a project to setup an anonymous feedback form to our website. I wanted to have a go at it with php</p>
  
  <p>the general idea is that I would have a password field (give out to our employees) a field for the feed back and a button to </p>
  
  <p>Ive seen this code snippet</p>
  
  <pre><code>&lt;?php
  $to = "recipient@example.com";
  $subject = "Hi!";
  $body = "Hi,\n\nHow are you?";
  if (mail($to, $subject, $body)) {
    echo("&lt;p&gt;Message successfully sent!&lt;/p&gt;");
   } else {
    echo("&lt;p&gt;Message delivery failed...&lt;/p&gt;");
   }
  ?&gt;
  </code></pre>
  
  <p>But im pretty sure with my limited understanding email systems that i can't just send out email (unless i have an open server somewhere which i do not) so i would need to log on to and email server (in my case gmails server)</p>
  
  <p>so how would i do this?</p>
  
  <p><strong>update:</strong></p>
  
  <p><strong>the code above does work but it doesn't come from a corporate account
  we currently use Google biz apps and that's why I would like to log on to a Google server to send this out.</strong></p>