title: PHP "mail()" function sends mail from php5 cli but not when the script is run by a browser
body: <p>I have configured my server to send mail by setting <code>"sendmail_path = "/usr/sbin/sendmail"</code> in "/etc/php5/apache2/php.ini" and sendmail is installed on the server.</p>
  
  <p>When I run this script, or any variation of it, from php5 via the cli the mail sends just fine, but when I have a browser run it, i.e. Chrome or Firefox, it fails everytime.</p>
  
  <pre><code>&lt;?php
   $to = "notreal@email.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>I am using the "php5-cli" package for a command line interpreter.</p>
  
  <p>Other PHP based web-apps that rely on the PHP "mail()" function don't send mail either.</p>