How to send email using Gmail SMTP?

I used to use this technique How to send email via Gmail SMTP in Yii2 framework | Wiki | Yii PHP Framework

But now it doesn’t work because since May 30, 2022 Google turned off third-party simple sign on:

Does anyone have experience running Yii2 and interfacing with Google for email?

Why not your domain?

Because I don’t know enough about domain management to handle email – there are all these spam technologies that I am unfamiliar with.

You always use an email that no one maintains. So when it almost full clean it. In some domain you can restrict the email to not receive any incoming mails and only send mails

For replay you can tinker arounder reply-to which tells email client to replay to a different email.

At any rate for anything serious, you either need to have your domain or connect to existing mailing services that are dedicated to do that!