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."
Sometimes a person's gender is unclear from a name _ names like "Corey" or "Blake," are both common women's and men's names. If that is the case, do some investigating to determine gender from searching on LinkedIn or a company website. But if it remains ambiguous, simply write out the person's full name, dropping the title. For example, "Dear Corey Meyer."