Daniel's link (sending mail with php & escaping hotmails junk folder) is going to be the most useful to you I think. We've been battling spam scores for years and had some decent success simply by following the rules, which you may find in the top answer for that link. In the end, we found it a lot easier to use a third party system like mail chimp to send mailers. Let them take the heat for your mail blasts.
Without providing a huge chunk of code that uselessly reinvents the wheel -
Make sure you have ALL proper headers in place.
Make sure you have an unsubscribe link
Try not to have an unreasonable image to text ratio. Like all image html emails will almost positively be spam to hotmail.
Research hotmail's spam guides and adhere to them
Everything else has been said over and over again.
Please keep in mind, I am not suggesting you use a third party system since that is not what you asked for in your question. I am simply telling you that the firm I work for has battled spam filters for years and though we have large success by following the rules, we have found it a lot easier to just let some other system handle the pain for us - and yes, you still need to follow the rules even if it is not your server. It is cheaper in the long run.
I would up daniel's answer if he turned his comment into a question.