Dya and Soheil's answers are both very good. In case it helps someone, I'm adding my own little trick for remembering which to use.
I pretend that the answer to the question I want to ask is a male in third person singular:
- Who spilled the milk? He spilled the milk. (Who? He.)
- Whom did you tell? I told him. (Whom? Him.)
- Do you know who called this afternoon? I know that he called this afternoon. (Who? He.)
- Whom is the present for? The present is for him. (Whom? Him.)
Of course, the actual answer may not be "he" or "him" - this is just a way to to keep the grammar straight. And this only works if you have a pretty good grasp of which male 3rd-person singular pronoun to use. :)