Have you looked at the Enrolment category in the Plugins database? https://moodle.org/plugins/browse.php?list=category&id=22 There are a couple in there that might do what you want.
Auto Enrolment based on email domain
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.