Hi Ahmet, the links I included were examples, for a local test Moodle 3.5 installation. The enrol by Profile field method won't help with what you want. Firstly, it works only with custom profile fields, and email address is a built-in field. Secondly, it doesn't support regular expressions such as *.gov.uk, so you can't use it to specify generic email addresses.
I don't know of any method which would automatically enrol a user on a specific course based only on their email address domain.