Google will be disabling access to less secure apps soon.
This is how to setup, authenticate and send an email using the quickstart.php demo PHP file from the Google Workspace developer samples GitHub repo:
https://github.com/googleworkspace/ph...
Code for this video:
https://github.com/toggenation/gmail-...
If I get time this first example will build to creating a Custom CakePHP 5 Email transport to send CakePHP 5 Application emails via the Google Gmail API.