In these days of email and instant messaging, letter writing is becoming a lost art, and especially the formal letter. I’m pretty sure that formal letter rules are still taught in schools, but very little of it sticks. If you’re an executive or other high_ranking person within an organization, you can probably rely on your secretary or assistant to handle the niceties of letter writing, but for everyone else, knowing how to write a strong letter ourselves is important.
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."