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."
There is a tendency to think that the often arbitrary rules of letter writing don’t really matter, that as long as your recipient can work out what you’re saying, that’s good enough. This shows a great deal of disrespect for your recipient, though, and for your own ideas. It suggests that a) your reader’s time isn’t valuable enough for you to write clearly and efficiently, and b) that you don’t particularly care about the content of your letter.