Wylie,
I have many times encountered this problem, where the fault is not in the machine itself but due to the machine being incorectly plumbed in.
If the outlet hose is 'hard-plumbed' into the sink waste pipe, smells from the drain can travel up the pipe into the machine. In this instace no ammount of machine flushing will solve the problem.
The correct connection is for the outlet pipe of the machine to enter a vertical pipe of sufficient diameter to allow air to be drawn down the pipe along with the water. At the bottom of this pipe should be a bottle trap, which exhausts to the drain. this pipe, if connected to the sink waste pipe should be below the sink trap.
The reason for the large diameter pipe is to prevent the trap being emptied by the suction caused by the last of the washing machine water as it leaves the lower section of the system.
Hope this is of help,
John.