The foul smelling water is caused by a combination of hydrogen, sulfur, and bacteria. The magnesium anode rod installed in the tank protects the tank surface, but generates enough hydrogen to create an odor when it interacts with sulfur in the water or bacteria in the tank. Replacing the magnesium anode rod with an aluminum anode may minimize the problem. The most efficient method of eliminating the hydrogen sulfide odor is to control the bacteria. As a rule, chlorination of public water supplies kills the bacteria, but some private well systems may need to be purified by the use of chlorine injectors or ultraviolet light. This will destroy the bacteria, however, if this does not work I recommend calling a plumber for help.