You have to get a App Password from Google, in order to send IMAP mails!
I hope this helps!
You can use outlook configuration Setup it might be helpfull for you to send mail.
For thus with problem setting up GMail Imap;
1- Enable IMAP in your Gmail account
2- Create a App Password https://myaccount.google.com/apppasswords
3- Follow the image for server port tls
Hi, Gmail has Stopped less secure apps. To help keep your account secure, from May 30, 2022, Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password.
For now no one can use Gmail in mendix.
Gmail suspended using the normal password for use in any third-party application. Now you need to create an app password to log in to Gmail using any third-party applications or web services.
Visit https://www.cloudbik.com/resources/blog/create-app-password-enable-imap-in-gmail/ to read how to create an app password and enable IMAP in Gmail.