Also, here's a summary of the way opioids work in layman's terms: Opioid analgesics suppress the perception of pain and calms a person's emotional response to pain by reducing the number of pain signals sent by the nervous and the brain's reaction to those pain signals.
The mu, delta, and kappa receptors to which opiates bind are located in several sites including the brain stem and cortex. The grouping of these sites comprise what is called the "ascending pain transmission system" and the "descending inhibitory system." It is the activation of these sites, normally binding with endorphins that are produced naturally in the body, that produces the effects of opiates.
Opioids are substances that bind to the mu opiate receptors on the surfaces of brain cells. These receptors are meant for naturally occurring chemicals produced in the body but the opioids in heroin and morphine have a structure that closely replicates of chemicals produced in the body and lead to analgesic effects and feelings that are pleasurable.
Opioids are synthetic, psychoactive chemical compounds derived from the sap of the opium poppy. They are narcotic, which means they are sleep-inducing. The most famous three are morphine, codeine, and heroin.
There are naturally occuring opiates in the human body that promote a feeling of well-being, relaxation, and sleep. Two of these such opiates are seratonin and endorphin. The synthetic opoids introduced into the body from the opium poppy bind to the opiate receptors in the brain, nervous system, and digestive system. They essentially slow a person's body systems down, suppress pain, and give a strong sense of peace and relaxation.
Please keep in mind the difference between the two terms opiate and opioid. Opiates are naturally occuring substances in the human body; opioids are synthetically-produced narcotic substances that are introduced into the body and act much the same as the natural ones. But, the opioids can have a harmful, if not fatal effect upon the body!
On a microscopic level, opioids target our G-protein opiate receptors with ligands (signal triggering molecules binding to a site on a target protein http://www.opiates.com/opiates/). The two bind together to produce the desired euphoric (rush) or catatonic (relaxed) effect. The person simply feels no pain, no responsibility.
The underlying purpose of taking opioids is either pleasure or reward. But, the sensation is only temporary and soon the person comes down off their "high" and back to reality. It's the repeated dosage that makes a person addicted to the drugs and soon their body can't handle not having the "fix." Total withdrawal from opioids can be dangerous, if not fatal, and the treatment is long and aggressive.