But when I change the order to make def.com the primary and abc.com the secondary, user@def.com's email is being blocked. The error says "unable to relay mail." Def.com is not an external domain.
I need to migrate all users to user@def.com and secondary as user@abc.com.
It sounds like some of your relay fields are not set up completely. Check your server configuration document. Wherever you see abc.com in relay fields, you should add def.com.
This was first published in June 2003