title: PHP sendmail works in Ubuntu command line, but not from a php file
body: <p>I installed sendmail with PHP and apache on Ubuntu. When I try the following command-line</p>
  
  <pre><code>php -r "mail('test@gmail.com', 'test', 'test')"'
  </code></pre>
  
  <p>it successfully sends the email. </p>
  
  <p>However, running the file "test_send_mail.php" with:</p>
  
  <pre><code>&lt;?php
  mail('test@gmail.com', 'test', 'test')
  ?&gt;
  </code></pre>
  
  <p>doesn't send an email.</p>
  
  <p>The unsuccessful attempt with the .php file generates the log entry:</p>
  
  <pre><code>`Jul  5 21:24:47 www sendmail[25603]: p661OlL7025603: from=www-data, size=106, class=0,
  </code></pre>
  
  <p>nrcpts=0, msgid=&lt;201107060124.p661OlL7025603@www.server.com>, relay=www-data@localhost</p>
  
  <p>The successful attempt with the command line generates the log entry:</p>
  
  <pre><code>    Jul  5 21:22:40 www sm-mta[25533]: p661MevV025533: from=&lt;root@www.server.com&gt;, 
  size=352, class=0, nrcpts=1, msgid=&lt;201107060122.p661Mecm025532@www.server.com&gt;, 
  proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
  </code></pre>
  
  <p>Does anyone have any idea what might be happening? Thank you for your help!</p>