There is no safe way to take an ecstasy pill because no one can possibly know what's in it. Even two tablets from the same supplier can have wildly different quantities of active ingredients, including several that can be exceedingly dangerous when taken together.
Ecstasy pills are frequently created with little or no control over the process, making it difficult to determine exactly what's in them without having them tested. Ecstasy is frequently mixed with a variety of drugs, including MDEA, PMA, MDA, ephedrine, LSD, and other potentially harmful ingredients such as insecticides, ketamine (horse tranquillizers), and cough suppressants, and many have been discovered to contain a variety of other substances of varying quality and toxicity.