title: How do I set up Pear mail?
body: <p>I'm trying to set up php mail with pear. I've been trying and researching for the past 4 hours  without success.</p>
  
  <p>I'm using this code</p>
  
  <pre><code>&lt;?php
   require_once "Mail.php";
  
   $from = "Sandra Sender &lt;sender@example.com&gt;";
   $to = "Ramona Recipient &lt;recipient@example.com&gt;";
   $subject = "Hi!";
   $body = "Hi,\n\nHow are you?";
  
   $host = "ssl://mail.example.com";
   $port = "465";
   $username = "smtp_username";
   $password = "smtp_password";
  
   $headers = array ('From' =&gt; $from,
     'To' =&gt; $to,
     'Subject' =&gt; $subject);
   $smtp = Mail::factory('smtp',
     array ('host' =&gt; $host,
       'port' =&gt; $port,
       'auth' =&gt; true,
       'username' =&gt; $username,
       'password' =&gt; $password));
  
   $mail = $smtp-&gt;send($to, $headers, $body);
  
   if (PEAR::isError($mail)) {
     echo("&lt;p&gt;" . $mail-&gt;getMessage() . "&lt;/p&gt;");
    } else {
     echo("&lt;p&gt;Message successfully sent!&lt;/p&gt;");
    }
   ?&gt;
  </code></pre>
  
  <p>And the 'require_once "Mail.php"' is giving this error:</p>
  
  <p><strong>Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in /home/creatif2/public_html/mail.php on line 3
  Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.:php/') in /home/creatif2/public_html/mail.php on line 3</strong></p>
  
  <p>Pear and Pear Mail is installed</p>
  
  <p><strong>Auth_SASL 1.0.6   Update Reinstall Uninstall Show Docs
  Mail    1.2.0   Update Reinstall Uninstall Show Docs
  Net_SMTP    1.6.1   Update Reinstall Uninstall Show Docs
  Net_Socket  1.0.10  Update Reinstall Uninstall Show Docs</strong></p>
  
  <p>And I'm quite baffled about it. I think my problem is setting the include path but I'm not getting anywhere with it.</p>
  
  <p>The packages <strong>are</strong> located within the php folder - (eg home/my_user/php/Mail.php, I'm using Justhost).</p>
  
  <p>The current configuration is
  <strong>.:/usr/lib/php:/usr/local/lib/php</strong></p>
  
  <p>Can someone please explain to me how to reference the Mail.php file properly? Been stuck here the whole morning and afternoon.</p>
  
  <p>Thanks</p>