title: Cannot use Mail.php from command line
body: <p>I have a php script that is going to be a cron job and it was working fine until I added the email script I have been using.</p>
  
  <p>I have used the email script all over the site before but when I try and run the cron job using it from the command line it fails.</p>
  
  <p>The mail script looks as followed </p>
  
  <pre><code>    &lt;?php
  
  require_once "Mail.php";
  
  function sendMail($to, $from, $subject, $message) {
  
          $no_errors = true;
  
          $host = "ssl://smtp.server.com";
          $port = "465";
          $username1 = "username";
          $password = "password";
  
          $headers = array ('From' =&gt; 'myfromemail@myemail.com',
            'To' =&gt; $to,
            'Subject' =&gt; $subject);
          $smtp = Mail::factory('smtp',
            array ('host' =&gt; $host,
              'port' =&gt; $port,
              'auth' =&gt; true,
              'username' =&gt; $username1,
              'password' =&gt; $password));
  
          $mail = $smtp-&gt;send($to, $headers, $message);
  
          if (PEAR::isError($mail)) {
  
              $no_errors = false;
  
              echo $mail-&gt;getMessage();
  
          } else {
  
              $no_errors = true;
  
           }
  
          return $no_errors;
  
          }
  
  ?&gt;
  </code></pre>
  
  <p>If I comment out the include send_mail.php it works fine but doesn't send email.</p>
  
  <p>Any ideas?</p>