Locate the source of the smell. Pull up the carpet and inspect it for wetness or mildew. Examine cushions and upholstery on furniture. Look for obvious signs of water damage and water leaks. If the sunporch sits over an open crawl space, examine the floor for signs of rotting or mold.
Fix any leaks around the foundation or windows and ensure that the soil slopes away from the house so water drains properly. Replace any rotten flooring boards and place a moisture barrier fabric on the soil in an open crawl space. If the sunporch has a concrete floor, it may attract moisture. Paint it with an enamel paint and sealer made for concrete.
Set a musty carpet outside on blocks and allow it to air dry completely, or if it is dry, sprinkle baking soda or carpet freshener on it. If mold is widely present, replace the carpet. Clean salvageable carpets well with a carpet cleaning machine or hire a professional to clean it.
Wash hard surfaces, such as walls or furniture with a solution of 1/2 cup chlorine bleach and 1 gallon water. Scrub the surfaces with a scrub brush or microfiber cloth. Rinse with clean water and dry thoroughly. Replace drywall that has mildew on it.
Take cushions outside and shake them off to remove dust and any mold spores. Machine wash cushions if possible, or clean them with a solution of 1 tbsp. liquid dish soap and 1 quart warm water. Rinse with clear water. Allow the cushions to dry in the sun, which will kill mold spores and remove odors.