Endorphins are chemicals in the blood that induce both pleasure and pain relief. They are released into the blood at times of pain and discomfort, such as when wounded, or after strenuous exercise. They are also a part of the body's 'reward' mechanism, and give a good feeling when a person has done something 'right'.
http://en.wikipedia.org/wiki/Endorphin

So we get endorphins and a good feeling after sex. A man will get more endorphins in his blood when he looks at a beautiful woman. A woman will get a rush of endorphins when she has spent time making herself look good and she is assured that she now looks beautiful when she looks in the mirror. We all get endorphin release when someone gives us a compliment. Some food causes endorphin release. If you have just completed an act of generosity, and are feeling good about it, blame endorphins.

Endorphins are the 'feel good' chemical, and fill a variety of roles in the body.