How do I add an email attachment to this mail script?

This email script sends text perfectly.  I need to add an attachment (XLS file) to this email script.  How do I accomplish?

I have tried several scripts such as PHPmailer on GitHub.com  and cannot get them to work.  

If you can suggest something easy that works...  

(Attachment is in the same directory as script)

$filename = 'backorders_2015-03-17.xls';

$to      = $receiver;
$subject = $filename;
$message = 'backorders from today';
$message = str_replace("\n.", "\n..", $message);
$headers = 'From: $myemail' . "\r\n" .
    'Reply-To: $myemail' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

Open in new window

lawrence_devAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marcus BointonCommented:
Really, go back to PHPMailer and base your code on one of the examples provided - even the one in the readme will do what you ask. Building messages like this from scratch is far, far more complicated than using a library to do it for you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lawrence_devAuthor Commented:
Thanks for your help!  I went back to the folder and found a sample file and was able to get it to work...  Pretty easy!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.