Welcome to e health forum.
Smelly or foul gas production is due to indigestion or dietary intake of foods, which produce more of hydrogen sulphide and other gases.
Cauliflower, eggs, and meat are most likely to produce the smelliest farts. Beans produce a greater quantity of gas, but not particularly smelly farts. In general, foods with little fiber produce very little gas.
First and foremost, you need to avoid foods that make your symptoms increase. Adopting a healthy dietary practices and a good exercise regimen will also improve your intestinal motility.
In addition, taking probiotic supplements and activated charcoal tablets (Charcoal, Charcocaps), will help in relieving your symptoms to a certain extent.
When malabsorption (reduced food absorption) occurs due to certain medical conditions, excess gas in the intestines, fever, weight loss, blood in stools, crampy abdominal pain and excessive flatulence is seen. Some conditions include - diverticulosis (with an overgrowth of bacteria), Celiac sprue, pancreatic diseases, lactose intolerance and Giardiasis.
In such condition, treatment of the underlying medical condition is needed after due evaluation. Hence if your symptoms persist even after following the above suggested measures, you should consult with a gastroenterologist for proper advice and treatment.