Sending Emails from within Reports View CTP file

Hi,
I am very new to CakePHP as I have just taken over from an external company that set this all up, so this is probably a very simple question… I need to be able to send a templated email from a simple web button in the reports view.ctp where the content is filled in for the email, name, etc from the $record[‘Data’] array. Can someone help me understand how I can create an onclick attribute in the html button to fire a javascript function to then send a templated email using CakePHP? Or is there a better way to handle this?
We have an old version I think - 2.7.3?
Thanks for any assistance.
Alex.

Update… worked out that I have to post a form then use PHP to check for the post… but still not working for some reason… no email is sent and the page does not load correctly. Couldnt find anything in PHP logs to show why it is not working though… Here is my code. Any ideas?

Although I feel silly when I solve my own issue before anyone else replies, here was the solution to the issue, all I needed was to ensure CakeEmail was added to the reports controller also and all good!!
image