Sending Mail Via Gmail with IMAP/SMTP

Google implements security steps 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 offered in the appropriate setting, the robot gives the relevant error.

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 following stages.