In the first paragraph of your cover letter, state how you found the job. Recruiters and HR professionals appreciate this for a number of reasons.
If you have a contact, mention that person by name. If you found the opening on a job board, mention the specific one. Or, if you found it on their website, say so.