I’ve been told that we can do something fanciful with Squirrelmail to support virtual hosting with a single system-wide installation, and so I will be spending some time figuring out how to do that shortly.
In the meantime, there is no automatic way to do this (the “official” webmail client for Virtualmin Professional is Usermin, and it should work this way out of the box, I think, though I know there are some issues to be addressed in the Usermin configuration–it’s coming in the next release).
What I had to do was add the "compatibility" and "vlogin" modules to SquirrelMail.
"compatibility" required a patch to SquirrelMail, but the instructions with the module covered that well.
I did have to monkey around with the conf.pl of the "vlogin" module. I had to set $dontUseHostName and $smHostIsDomainThatUserLoggedInWith to 1.
I’m not sure why I had to set the $dontUseHostName. Until I did that, I couldn’t not log into SquirrelMail at all. I guess it was appending the domain name to the login.