title: Sendmail with Ubuntu and PHP
body: <p>I'm trying to get <code>Bitnami Magento</code> to send email on an <code>AWS EC2 Ubuntu</code> instance.  Before dealing with the <code>Magento</code> configuration I am just trying to get <code>php</code> to send mail.</p>
  
  <p>This works </p>
  
  <pre><code>echo "My test email being sent from sendmail" | /usr/sbin/sendmail toemail@mydomain.com
  </code></pre>
  
  <p>This doesn't</p>
  
  <pre><code>&lt;?php
      $to = 'toemail@mydomain.com';
      $subject = 'the subject';
      $message = 'hello';
      $headers = 'From: fromemail@mydomain.com' . "\r\n" .
          'Reply-To: fromemail@mydomain.com' . "\r\n" .
          'X-Mailer: PHP/' . phpversion();
  
      mail($to, $subject, $message, $headers);
  ?&gt;
  </code></pre>
  
  <p>It doesn't work from the browser or if I run it from SSH, like this</p>
  
  <pre><code>$php my_php_email_test.php
  </code></pre>
  
  <p>It gives this error </p>
  
  <pre><code>sh: 1: /usr/bin/sendmail: not found
  </code></pre>