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.
Hugo website instructions for a multilingual PHP mail() contact form. With honeypot input fields, input validation and error output. A lot of effort for a simple but secure contact form.