In high school, Shelley Goldsmith was a student council president and tennis team captain. She’d won an academic scholarship to the University of Virginia, had raised money for the American Heart Association and baked cupcakes for cancer patients when her dad was going through chemotherapy.

The Abington, Virginia, teen also loved music. In August 2013, Goldsmith, then 19, attended a rave concert at a club in Washington where she took some Molly, a popular recreational drug. After a few hours of hard dancing, she collapsed. She died several hours later at a hospital.

A purified version of ecstasy, or MDMA, Molly is commonly thought to be a safe drug, and it has been popularized by such singers as Miley Cyrus, Kanye West and Rihanna. It produces a high that users say allows them to dance tirelessly, be more open and uninhibited emotionally, and experience euphoria and heightened sensory awareness. The Drug Enforcement Administration says no other drug is quite like MDMA, creating amphetamine-like energized feelings and mild mescaline-like hallucinations.

In the 1970s, MDMA was prescribed as an aid to psychotherapy to improve patients’ insights about their problems and enhance their ability to communicate with their therapists. In 1985, as the drug began showing up in clubs and other nontherapeutic settings, the DEA grew worried about abuse and banned it.

Recently, though, clinical trials of MDMA have been approved for treating post-traumatic stress disorder, anxiety in terminal cancer patients and social anxiety in adults with autism. Some have shown promising results.

The Molly sold on the street often is laced with other substances — such as acetaminophen, amphetamines and ketamine, a compound used in anesthesia — that can be deadly in large enough doses, according to an NYU Langone Online Journal of Medicine article.

Molly typically works in about an hour, and its effects last a little more than seven hours. In addition to causing users to feel good, it can cause paranoia, anxiety, depression, loss of appetite, dry mouth, hot and cold flushes and teeth grinding.

In February, 10 Wesleyan University students and one guest at the Connecticut college were hospitalized, some in critical condition, according to Mark Neavyn, director of toxicology at Hartford Hospital, who was in the emergency room when some of the young people came in. Although they had taken what they thought was Molly, Neavyn said, blood and urine tests suggested they had actually ingested other chemicals and drugs.

All of the hospitalized students eventually were released. Two Wesleyan students, Zachary Kramer, 21, of Bethesda, Md., and Eric Longeran, 22, of Rio de Janeiro, face federal charges, including for distributing synthetic drugs.

With its friendly-girl-next-door name and its embrace by music culture, Molly began to grow in popularity beginning in about 2004, according to figures from the Office of National Drug Control Policy. A 2013 report from the Substance Abuse and Mental Health Services Administration found that annual estimated visits to hospital emergency departments by people 21 and younger involving the drug increased 128 percent — from 4,460 to 10,176 — between 2005 and 2011, though 2010 may have been the peak.

IT’S ‘ALL OVER’ CAMPUSES

“We like to party dancing with Molly/ Doing whatever we want,” sings Miley Cyrus.

“Something about Mary, she gone off that Molly/ Now the whole party is melted like Dalí,” raps Kanye West. From Rihanna: “Palms rise to the universe/ As we moonshine and Molly/ Feel the warmth, we’ll never die/ We’re like diamonds in the sky.”

Patil Armenian, an emergency medicine and medical toxicology physician at the University of California at San Francisco/Fresno, says Molly “is now a mainstream drug, not just a club drug. It is all over college campuses, high schools . . . used by those in their 30s and 40s. It was once thought of as a middle-class Caucasian drug, but we are seeing it in the African American population as well.”

Armenian, whose main area of research is MDMA and designer drugs, said that a huge problem is that the various pills and powders being sold on the street as Molly have unknown strength and chemical composition so that anytime people use it, they are taking a huge risk.

“We have seen terrible outcomes even with pure MDMA,” Armenian said. “The poison is in the dose. Everything is poisonous if you take enough of it.” Goldsmith’s mother, Dede Goldsmith, said a toxicology report found that her daughter’s death was the result of ingesting pure MDMA.

Armenian and Neavyn said Molly is easily obtained, often under the label of research chemicals on what is called the dark Web — sites that conceal their addresses and are reachable only through special browsers. Working with a DEA agent to avoid legal problems, Armenian said, she was able to buy as part of her research a chemical compound very similar to pure MDMA, paying for it via PayPal. “It was impressive how easy it was,” she said.

When people have died after taking Molly, Armenian said, it has usually been due to serotonin syndrome, which causes agitation, rapid heart rate, high fever, high blood pressure, loss of muscle coordination, seizures and unconsciousness. Anyone taking antidepressants is at greater risk because the drugs increase the effects of serotonin, which become magnified by MDMA.

Andrew Bazos, founder of CrowdRx, which provides emergency medical services at many summer concerts, says the combination of music, drugs, heat and nonstop dancing is a perfect storm for trouble.

“With dropping sodium levels, electrolyte imbalance and increased body temperature, it creates an inhospitable environment for the heart and brain to live happily and normally,” said Bazos, who is also a physician at the New York University School of Medicine. Molly fools the body’s temperature-regulating system to stop functioning properly, he said, allowing a concertgoer to overheat to a dangerous extent.

CrowdRx EMTs are constantly on the lookout for people having trouble walking, thinking and answering questions. In addition, they screen those in trouble for increased temperature. CrowdRx purchased a device (I-stat) that measures electrolyte levels on-site so that if necessary someone can get IV fluids right away to correct electrolyte levels. They also have cooling baths to treat those with rising temperatures.

Bazos and Neavyn say anyone tempted to enhance the concert experience by using Molly should think twice. These are chemicals developed in laboratories for research, Neavyn said. “When you start experimenting with research chemicals, even the most skilled chemists can get it wrong. You just don’t know what you are getting when you take that capsule or snort that line,” he said. “That one bad choice can be your last choice.”