Multi Domain Users all going to 1 Department, how to set to respective departments,

Multi Domain Users all going to 1 Department, how to set to respective departments,

Hello all, 

We are new to zoho desk (paying customer), we have created multiple departments in desk with the scope that each domain has its own department, for example user@a.com emails issue should go to A Department, then user@b.com emails issue should go to B Department and so on...

currently all users irrespective of thier domain go to our main department, kindly advise what needs to be done to create a rule like:
if *anyone*@a.com move ticket to A Department
if *anyone*@b.com move ticket to B Department

and if possible to auto-assassin all tickets to a respective tech?

Regards,
W