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.
Comments
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.