Yurec
your errors are permission:
Gmail settings:
This can be different based on your Gmail account settings, so check your Gmail settings and make sure to have the correct hostname, port, and protocol, etc… Header spoofing is not needed.
Authentication “Yes” / MTA set as default SMTP account / PORT – 587
If you are using (G Suite) or 2FA settings you will need to create an app password:
Log in your Gmail account and access the following link
Go to security and click the app password.
Select the app or Give a custom name that makes sense to you and click generate, now use that app-specific password in your osTicket system.