If you are writing to someone who has a doctorate or medical degree, use the abbreviated form: "Dr." However, for other titles, such as professor, judge, rabbi, etc., write out the full title and capitalize it. For example, your salutation in a letter to a judge would be, "Dear Judge Barnard." Or, if your correspondence was with a rabbi, you might write, "Dear Rabbi Williams."
However, before using a general salutation (or leaving off a salutation), try to find out the name of the person you are contacting. If you are applying or inquiring about a job and the hiring manager’s name is not included on the job listing, you might look up the title of the employer or hiring manager on the company website. If there is a contact number, you might also call and ask an administrative assistant for the name of the hiring manager. If you are sending a different type of letter, you can still look up the person’s name on the company website, or speak to an administrative assistant or contact at the company for the name of the person you are trying to reach.