Here's a really good link.
http://www.emedicinehealth.com/encopresis/article_em.htm
Please do also be aware that not all pediatricians are very good on treating encopresis. If yours seems like he doesn't have a clue, ask for a referral to a pediatric gastroenterologist.
Pooping in the pants without awareness that it has happened, and the resulting stool having a really foul odor, are hallmarks of a medical condition called encopresis. Please see your pediatrician about this, your son is suffering from an impacted bowel and distended colon that is not working properly. The colon can be emptied at the hospital, and the child needs to have a long, long run of stool softener every day, to allow the lower intestine and colon to heal. I'll see if I can find a reference for you.
how long has he been doing this is it recent, has he been upset by anything, and how about school does he do this when he is there or only at home ?