Method Not Allowed. Must be one of: GET when I submit a form

I am new to Slim as well as PHP. I have been trying to send a form for a while with no luck.

My mail.php code is in same folder as the contact form.
my form is having action=“mail.php” and method=“post”>.

I also tried write route for mail.php

$app->post(’/mail’, function ($request, $response) {
return $this->renderer->render($response, ‘mail.php’);
and updated action = “/home/mail” but same problem.

That is a get call, loading the mail.php. To use both get/post, you could use:
$app->map([‘GET’, ‘POST’], ‘/ROUTE’, function($req, $res, $args) {

Then, inside of it you can use if $response->isPost() or whatever.