The distinction is not whether a preposition is involved or not, it is whether the "who/whom" word is operating as an object ("whom") or a subject ("who"). That's why delinka's mnemonic also works.
In both "to whom is the message addressed" and "whom do you trust", "whom" is an object, not a subject.
All that being said, it is increasingly a common and acceptable practice to use "who" as both an object and a subject, so it's probably not worth losing too much sleep over.
The mnemonic I got in school was that if you can answer with "him" then it should be "whom."
Who made this? He made this.
Whom do you trust? I trust him.
This mnemonic is predicated on answering in complete proper sentences. I realize that in current colloquial English, "Who made this? Him." is certainly an exchange one might encounter.
Just FWIW, it is not in the dative case. The dative case is only for indirect objects (which follow pronouns), or direct objects specifically related to the act of giving. Trusting is not giving, and there is no prepositional phrase in this sentence, and so the pronoun is a direct object. But yes, it still passes the test for whether it's objective or subjective.
In both "to whom is the message addressed" and "whom do you trust", "whom" is an object, not a subject.
All that being said, it is increasingly a common and acceptable practice to use "who" as both an object and a subject, so it's probably not worth losing too much sleep over.