Community & Support

Automatically assign subdomains to users based on email domain

I have a question for the community.

I am using Domain access module with Drupal 6. I have setup subdomains for my installation for different cities.

Is it possible to assign a user to a subdomain (so that all content is posted to that domain) from their email domain?

To try and explain in steps....

Default domain is example.com

User signs up for example.com with a gmail.com email address.

User is automatically assigned to newyork.example.com from the gmail.com email address.

User signs up for example.com with a yahoo.com email address.

User is automatically assigned to philly.example.com from the yahoo.com email address.

How could something like this be done? Is this something I write as an extension module for domain access?

How could I specify this at the time of registration?