The PHP function mail() requires a working Postfix or similar mail server configuration on a local web server. This guide helps to configure Postfix on macOS. For the popular PHPMailer, the Postfix configuration and the change in the MAMP php.ini are not required. It just depends on the purpose of the mail application.
If PHP is to be used within Hugo, e.g. for a contact form, MAMP for macOS is one way to realise this. The local server environment allows testing PHP with Hugo as on a web server on the internet.