Generally, PHP is configured to talk to the correct SMTP server for all PHP scripts that run. Your hosting provider does this for you.
And, this is usually the same server as the one where you're running FormMail.
Therefore, no authentication is required for PHP to send mail from that server.
If you're asking PHP to send via an external server, then you will need to authenticate, and I don't think there's any way to configure PHP to do that automatically.
So, that means you'll need to add some PHP code to FormMail to perform the low-level SMTP protocol.
It's certainly do-able, but it's strange that you need to do it.
Would you like to describe, perhaps pictorially, what your whole setup looks like?