I would suggest you do a search for a PHP mailer class that encompasses all you need rather than the method you are currently trying to use. Here is an example bit of code I use with my class which demonstrates how easy it is to send with an attachment:
require_once($_SERVER['DOCUMENT_ROOT'] . '/includes/class/class.phpmailer.php');
$datenow = date ("l jS F Y");
$mail = new phpMailer();
$mail->Priority = 2;
$mail->IsHTML(true);
$mail->From = VENDOREMAIL;
$mail->FromName = VENDORNAME;
$mail->Subject = VENDORNAME . " Online Enquiry Submitted.";
$str = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/includes/emailtemplates/contactus.html');
$str = str_replace("%N", $firstname . " " . $lastname, $str);
$str = str_replace("%E", $emailaddress, $str);
$str = str_replace("%T", $phonenumber, $str);
$str = str_replace("%Q", nl2br($enquiry), $str);
$mail->Body = $str;
$mail->AddAttachment ($_SERVER['DOCUMENT_ROOT'] . '/files/','file.txt');
$mail->AddAddress (SENDTOEMAIL, SENDTONAME);
$mail->AddBCC(WEBMASTEREMAIL, WEBMASTERNAME);
$emailsent = $mail->Send();