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."
I can’t tell you how many truly awful letters I’ve had to read in my life. As a former administrative assistant, I was responsible for all the unsolicited submissions to a major New York museum. Artists and collectors all over the country (and abroad) wrote to have their work considered for display or acquisition, and to be honest the decision frequently rested more on the quality of their cover letter than on their work _ which, romantic dreams aside, rarely if ever sells itself.