As an avid psycoactive substance enthusiast, I hear horror stories like this all the time; and it saddens me deeply.
There are three things one MUST know to have a safe time: Know your Body, Know your Substance, and Know your source.
I'm afraid all three of things were unknown in your case, and I'm sorry that the drug people around you were so wreckless with themselves as well as yourself.
Specifically with MDMA, I always test what I receive before doing it. Test kits can be legally obtained at http://www.dancesafe.org/, lab test results on alleged MDMA pills throughout the world can be found here http://www.ecstasydata.org/
Please don't preach drug abstinence, but preach drug responsibility. Humans will always do drugs, let's just try to keep them safe!
As always, don't abuse, use! Have fun!