It's as important to tell an applicant that he didn't get the job as it is to tell him he did get it. It projects a positive image about the company. Keep the letter brief but encouraging.
1234, Main Street
Boston, MA 02123
<Recipient Address Goes Here>
Thank you for your interest in Abc Company. We had many qualified applicants for the position of <job title>. I regret to tell you that we offered the position to another candidate.
We were impressed with your credentials and are certain that you will find the right position to take advantage of your skills and experience. We hope that you will keep Abc Company in mind in the future. Best of luck in your job search.
encl: <List of enclosed items goes here>