Hi there,

Before any of this can work, we need to establish a few things about your setup:

  • That you can view PHP pages with your browser that are served up via Apache (the 'A' in MAMP)
  • That PHP's mail() function works as expected
  • That PHP's header() function works as expected

Sorry if this feels like we're taking steps backwards, but it is important to do this now, as even if you manage to patch together something that works for you locally, it'll most likely break as soon as you deploy it to a remote server.

So, let's start over.

From the MAMP documentation:
By default, PHP and HTML Pages should be stored inside the MAMP "htdocs" folder which is located in the MAMP Application directory /Applications/MAMP. This folder is called "Document Root".
Please do the following:

Change the path for the Document Root back to "/Applications/MAMP/htdocs".
You can do this in the MAMP application's Preferences Panel.

Copy the following code into a file and save it as "test.php" in the aforementioned "htdocs" folder.

PHP Code:
echo "Hello, world!<br>";
"Current server time is: " date("H:i:s");
Navigate to http://localhost:8888/test.php

What do you see?