Using too much soap in the washing machine is a common cause of a mildew smell. High-efficiency machines, including front-loading machines, use much less water than a traditional machine. The film that remains provides a breeding ground for mildew in the machine.
Detergent manufacturers address the problem by providing HE detergent. The low-suds formula is easier to rinse from the machine using the smaller amount of water. When using HE detergent, following the manufacturer's recommendation for amount of detergent reduces the chances of mildew odor. With the smaller amount of water, the consumer must also reduce the amount of fabric softener in each load. Additional fabric softener causes a waxy buildup that encourages mold growth.
If the machine has mildew due to a load of clothing left too long before transferring it to the dryer, it is often possible to remove the smell using vinegar or oxygen bleach. Fill the machine again and add 1 cup of vinegar or the manufacturers recommended amount of oxygen bleach to the water. Allow the machine to agitate to mix the product with water and stop the cycle. After an hour, start the machine again and complete the full wash cycle without adding more detergent.