Get Error When Sending Mail Via Gmail with IMAP/SMTP

I want to send mail via gmail with IMAP/SMTP, but I am getting the following error, how can I solve this error? can you help me?


There are security steps implemented by Google to ensure the security of the Gmail account. The first time you request a connection to your Gmail account from any environment, the security steps provided by Google must be passed. In cases where access to the Gmail account was not provided before in the relevant environment, the robot gives the relevant error.

Solution: Since you will complete the said safety step when you provide the first entry from the environment where the robot is located, your robot will be able to work as expected without this error in the next stages.