Attached file cannot be Viewed
<p>I am sending e-mails through php mail(). In that, I am able to receive simple(text) mails. When I attach the file, I am receiveing the attachment in the e-mail, but when I try to view it, the file is always blank, even when its a PDF Format!!!. Please help me out. The code of my send-mail page is as follows:</p>

<pre><code>include_once("db_connect.php");
session_start();
error_reporting(16);
require_once('class.phpmailer.php');//Getting values from Session
$tot = $_SESSION['$tot'];
$from = $_SESSION['from'];
$message = $_SESSION['message'];
$subject = $_SESSION['subject'];
$full_nm = $_SESSION['firstnm']." ".$_SESSION['lastnm'];
$temp_passwd = $_SESSION['e_pwd'];
$email_use = $_SESSION['email'];

function send_mail($to, $message, $subject, $from, $temp_passwd, $full_nm, $email_use)
{
    $message_org      = nl2br($message);
    $mail             = new PHPMailer();
    $body             = $message_org;
    $mail-&gt;IsSMTP(); 
    $mail-&gt;SMTPAuth   = true;
    $mail-&gt;SMTPSecure = "ssl";
    $mail-&gt;AddAttachment("Uploads/file.pdf");
    $mail-&gt;ContentType = "mutlipart/alternative";
    $mail-&gt;Host       = "smtp.mail.yahoo.com";
    $mail-&gt;Port       = 465;
    $mail-&gt;Username   = $from;
    $mail-&gt;Password   = $temp_passwd;
    $mail-&gt;SetFrom($from, $full_nm);
    $mail-&gt;Subject    = $subject;
    $mail-&gt;MsgHTML($body);
    $address = $to;
    $mail-&gt;AddAddress($address, $address);

    if(!$mail-&gt;Send())
    {
        $err_send = "Mailer Error: " . $mail-&gt;ErrorInfo;
    }
        else
    {
        $err_send = "";
    }
}
foreach($tot as $to_trim)
{
    $to = trim($to_trim);
    send_mail($to, $message, $subject, $from, $temp_passwd, $full_nm, $email_use);
    echo $err_send;
}

The function AddAttachment in class.phpmailer.php is as follows:

public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
try {
  if ( !@is_file($path) ) {
    throw new phpmailerException($this-&gt;Lang('file_access') . $path, self::STOP_CONTINUE);
  }
  $filename = basename($path);
  if ( $name == '' ) {
    $name = $filename;
  }

  $this-&gt;attachment[] = array(
    0 =&gt; $path,
    1 =&gt; $filename,
    2 =&gt; $name,
    3 =&gt; $encoding,
    4 =&gt; $type,
    5 =&gt; false,  // isStringAttachment
    6 =&gt; 'attachment',
    7 =&gt; 0
  );

} catch (phpmailerException $e) {
  $this-&gt;SetError($e-&gt;getMessage());
  if ($this-&gt;exceptions) {
    throw $e;
  }
  echo $e-&gt;getMessage()."\n";
  if ( $e-&gt;getCode() == self::STOP_CRITICAL ) {
    return false;
  }
}
return true;
}
</code></pre>
