I prefer to control my emotions whenever I can. It depends on the situation and whether or not I have the time to do so, but, if possible, I take a deep breath and make myself stop and consider my situation before allowing myself to respond to it. For example, if someone were to email me something really nasty, I might take an hour or two, or even a day, to respond. This ensures that I am more able to control my emotions as I reply to what they've said. This way, there's not as much room for regret afterwards.
If it's something face to face, I ask the person to leave me be. If I'm angry, I'll say something like "I'm too angry right now to talk to you. Leave me alone." Once I've calmed down, I go back to that person and try to resolve things. I've lost friendships and gone through too much unnecessary drama to allow my emotions to go out of control for short term gain. It's not always possible to do that (in that last example, most people won't let me just walk away) but it's best to take advantage when you can and really consider those negative emotions before taking them out on anyone else.
If it's all something internal that you are dealing with on your own, talking it out with someone always helps me. If you'd rather keep it to yourself, write it out. Even positive emotions are good to get down on paper and go over later.