title: Attaching file in the php mail code
body: <p>This code is working fine in my unix shared hosting account but how do I attach file with it?
  I've removed the hostname, login, passwd etc.</p>
  
  <pre><code>&lt;?php
  require_once "Mail.php";
  
  $from = "contactus@site.com";
  $to = "to email id";
  $subject = "this is the message from your domain";
  $body = "give your message body here";
  $host = "mail.site.com";
  $username = "user";
  $password = "pass123";
  $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("" . $mail-&gt;getMessage() . "");
  } else {
    echo("Message Sent successfully  ");
  }
  ?&gt;
  </code></pre>