How to address a professor in letter?
The appropriate way to address someone is with their proper title. In your question, it seems you know what the title should/should not be. If you know, use it. If you don't know, it's generally safer to err on the side of formality.
While I personally prefer (and request) everyone to refer to me by my given name, I do feel it a little strange when someone I do not know / have never met addresses me in writing by my given name. Perhaps I am old fashioned but I expect introductions to be formal (and better to be too formal than too familiar) and then quickly get to preferred ways of addressing (i.e., to use my given name).
When corresponding (in writing or electronically) I would look to the signature. If they wrote:
Dear Professor Schmoe:
Blah blah blah
Sincerely,
John
-----
Dr. John Doe
Agri-science Department
University of Whatchamacallit
Then I would write back
Dear John:
Thank you for your letter. Blah blah blah.
Sincerely,
Joe
This is a sticky question. Preferences for academic titles varies between countries, institutions and individuals.
In the US, any individual employed in an instructional capacity by an institution of higher education can be properly addressed as "Professor Smith", even if his or her official title is "Assistant Professor", "Lecturer", "Adjunct Instructor", etc. Moreover, any individual holding a doctoral degree can be addressed as "Dr. Smith".
Of course, these two cases often overlap, and you are left to decide whether to use "Professor" or "Dr.". The pattern I've observed is that at institutions where only some of the faculty have doctorates, those who do are more likely to prefer "Dr."; whereas at places where almost everyone has a doctorate, they will all prefer "Professor".
I think the safest default, and the one I most commonly see, is
Dear Professor Smith,
I would not abbreviate "Professor" as "Prof.". It sounds too much like an annoying student saying "Hiya, prof!"
This depends on a number of factors, not limited to the country the professor is in, the actual title, the type of correspondence (formal/informal), and the professor's personal preference. In the U.S. in computer science, for instance, virtually everyone goes by first names, almost regardless of university affiliation or rank.
I would avoid Mr./Ms. if you know there is an academic title (and these days, unless you have demonstrable evidence that the person prefers it, never Mrs.). I happen to prefer people use my first name, but I have to admit that it does tweak me a little bit if someone who should know better calls me "Mr." instead of "Dr." ("I didn't spend six years in evil medical school to be called 'Mister', thank you very much!") I shake my head whenever I get an email from my PhD alma matter when they refer to me as "Mr." -- of all the places or people in the world that should get this right, they don't!
If you're in a country where it seems to matter (Germany comes to mind), call the person's office and ask explicitly (or figure it out by going to the professor's web site or the school site). Otherwise, I suggest that for a formal never-been-introduced letter you should use either "Dr." (if applicable) or "Professor" (for all ranks of professor), or if you're in a field where first names are standard, go with that. For unofficial correspondence, you will be safe with the formal titles, but shouldn't have a problem with a first name.