How well do you deal with rejection? Some people are able to shrug it off, while others feel devastated.

According to a new study from the University of Michigan, blame it on your brain,. People who were best at shrugging off rejection produced more natural opioid painkillers in their brains when rejected. They also tested higher in a personality trait called resilience.

When they were lying in a brain imaging machine, they were told that the people they found attractive were not interested in them at all. Rejected!

“This is the first study to peer into the human brain to show that the opioid system is activated during social rejection,” David T. Hsu, Ph.D., the study's lead author said in a statement. “In general, opioids have been known to be released during social distress and isolation in animals, but where this occurs in the human brain has not been shown until now.”

Participants in the study were asked to view simulated profiles of hundreds of other adults, much as they would during online dating. Each person selected a few profiles of others they would be the most interested in romantically.

Then, when they were lying in a brain imaging machine called a PET (positron emission) scanner, they were told that the people they found attractive were not interested in them at all. Rejected!

Brain scans made at that moment were able to detect opioid release by measuring how full opioid receptor sites on brain cells were. These are the places where the brain's natural painkillers bind and release their pain-relieving effects. Full sites were evidence of painkiller production by that part of the brain.

Painkiller production was highest in several brain areas known to be involved in registering physical pain.

In particular, the more opioid released after social rejection in the pregenual cingulate cortex, the less the participants reported being put in a bad mood by the news that they'd been snubbed.

These results have several implications. Not only does it show why emotional pain, like the pain of rejection, hurts as much as physical pain, it tells us that the brain also tries to cope the same way.

So when you are faced with difficult acquaintances who are less able to handle the minor slings and arrows of social intercourse, it may help to consider that they may have a chemical imbalance rather than a prickly personality.

Perhaps most importantly, the study offers a clue into the chemistry of well being, and hints at future treatments. For if people with depression or social anxiety are less capable of releasing opioids during times of social stress, perhaps this deficiency can be corrected.

The study appears in Molecular Psychiatry.