Endorphins block pain, but they're also responsible for our feelings of pleasure. It's widely believed that these feelings of pleasure exist to let us know when we've had enough of a good thing -- like food, sex or even companionship -- and also to encourage us to go after that good thing in order to feel the associated pleasure.
The majority of your emotions (and memories) are processed by your brain's limbic system, which includes the hypothalamus, the region that handles a range of functions from breathing and sexual satisfaction to hunger and emotional response. The limbic system is also rich with opioid receptors. When endorphins reach the opioid receptors of the highly emotional limbic system, and -- if everything is working normally -- you experience pleasure and a sense of satisfaction.
Intriguingly, endorphins (or a lack thereof) may be responsible for certain forms of mental illness such as obsessive-compulsive disorder. When you, the average person, are washing your hands, there's a point when you register that the task has been satisfactorily completed. If endorphins are at least partly responsible for saying "when," a person who doesn't have enough may never receive the mental cue to stop washing his or her hands and will continue until that signal is received.
It's been theorized that problems with endorphin production or the binding process may be responsible for clinical depression or sudden shifts in emotions. Some people who engage in self-hurting behaviors may do so in part to feel the feelings of euphoria and emotional isolation that can -- for them -- be prompted by controlled amounts of self-inflicted pain.
Endorphins may also be responsible for heightened states of rage or anxiety. If your endorphins overdo their job or the hypothalamus misreads the endorphin cue, you could be flooded with "fight-or-flight" hormones at the slightest hint of trouble or worry.
Endorphins affect us like codeine or morphine do, but without the addiction. Regular users of opiates generally aren't models of emotional stability, and steady, controlled endorphin release is something of a pipe dream. Making matters worse, some of us have brains that act like ambitious drug dealers, and others of us only dabble now and then. This variation can help explain why one person reacts differently from another to the same stimulus.
Endorphins have a leg up on opiates, however. Endorphins may be responsible for the "placebo effect," owing to the real response of endorphin-release prompted by a tricked hypothalamus, creating a sense of well-being after consuming a much-hyped sugar pill, or even after simply anticipating something pleasurable.