Virtual hosts with smtp


I’m very new to Nginx mail proxy feature.

I have two domains that I want to be served from the same machine but
different mail server application (both SMTP and POP3), running on
different ports to avoid conflicts.

Is this a valid use case for Nginx? If yes, can anyone share a Nginx
configuration script to support that?

Help is much appreciated!