In my basement I often notice a sewer smell. It is likely caused by an open drain (I think it has a trap) that is used as an outlet for my washing machine and water heater's overflow drain pans. Because there is never any water going down these drains I believe the water is either stagnant or dries up sometimes.
The drain is in a cutout part of the skirting board so it would be hard to add a cap without cutting more of the board out. So temporarily to stop the smell I have taken out the pipe from the drain pans and covered the sewer pipe with a large block of plumbers putty to cover the hole.
What is the solution to this that would be up to code? It's a flipped house I have been in for a while and I am sure they were not supposed to do this. Ideally I need a place for my drain pans to go without releasing sewer gas!
Thanks

