This, as shown in an extreme example in the photograph to the right, is caused by a bacteriological build-up in your machine due to poor cleaning. It really is that simple and, all too often, it is caused by incorrect detergent use.
What happens is that under-dosing or using the incorrect detergent for too long without performing a maintenance wash will allow bacteria to build up in the washing machine which will grow very happily in the warm damp conditions which will eventually lead to what is shown here on the door seal or door rubber as some people call it.
Also using solely liquid detergents, liquid tablets, colour only powders (or liquid) as well as most of the "alternative"products like Soapnuts, Ecoballs and Ecover do NOT contain any bleach and will not remove any bacteria effectively. Should you wish to use these alternative products you will also have to add bleach to prevent "greying" of your whites over time as well as other problems.
You can read much more on these natural products in this article
Leaving the machine door slightly ajar when not in use also massively helps as this allows the seal to dry out and hinders the growth of bacteria inside the washing machine's drum as well as the door seal.
As you can see from the photograph the effects are extremely visible and noticeable to the naked eye and, whilst a maintenance wash will help the situations, depending on how bad it is there may well be no alternative but to replace the door seal. On most washing machines you can expect to pay about £60-80 to have this done by an engineer using the engineer search if it really is bad.
Ultimately the only real cure is a replacement door seal on the washing machine and regular maintenance washes thereafter.
But before you call an engineer in try cleaning the seal with a little bleach solution and a cloth, it may clear it if it's not too bad.
There have been some reports of other cleaning products working in some instances, but these are sketchy at best for the most part and it is very hard to get into the crevices of the door seal to get it clean.
In cases where this does happen, I'm afraid that almost every time it's too late by the time that you do something about it and there is little alternative bar a replacement door seal and that prevention is better that the cure. Of course you can find a replacemnet door seal for your washing machine in our washing machine spares section.
To keep your door seal clean we can recommend the use of Affresh. We're not saying that it will cure every single cases because, as we said, if it is really bad already the only solution is to replace the door seal, but as a preventative cure and the general health of your washing machine it is very good.
More On Washing Machine Cleaning
You can find more, as well as related, information on the effects of not carrying out a maintenance wash from the following articles:
Smelly Washing Machines how to avoid nasty smells and get rid of them
Washing Machine Soap Drawers how to clean them to avoid smells and bacteria build ups
Maintenance Wash What it is and why it is important
Whiter Whites, Brighter Colours how to use detergents correctly.