title: How Do I Check To See If PEAR Is Installed On My Server or Not?
body: <p>I am getting error like:</p>
  <blockquote>
  <p>Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in /usr/local/lib/php/Mail/smtp.php on line 348</p>
  <p>Warning: include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/lib/php/Mail/smtp.php on line 348</p>
  <p>Fatal error: Class 'Net_SMTP' not found in /usr/local/lib/php/Mail/smtp.php on line 349</p>
  </blockquote>
  <p>My code:</p>
  <pre><code>require_once 'Mail.php';
  
  $from = &quot;me@example.com&gt;&quot;;
  
  $to = &quot;you@gmail.com&gt;&quot;;
  $subject = &quot;Hi!&quot;;
  $body = &quot;Hi,\n\nHow are you?&quot;;
  
  $host = &quot;mail.example.com&quot;;
  
  $username = &quot;me&quot;;
  $password = &quot;test&quot;;
  
  $headers = array ('From' =&gt; $from,
    'To' =&gt; $to,
    'Subject' =&gt; $subject);
  
  $smtp = Mail::factory('smtp',
    array ('host' =&gt; $host,
      'auth' =&gt; true,
      'username' =&gt; $username,
      'password' =&gt; $password));
  $mail = $smtp-&gt;send($to, $headers, $body);
  
  if (PEAR::isError($mail)) {
    echo(&quot;&lt;p&gt;&quot; . $mail-&gt;getMessage() . &quot;&lt;/p&gt;&quot;);
   } else {
    echo(&quot;&lt;p&gt;Message successfully sent!&lt;/p&gt;&quot;);
   }
  </code></pre>