Does Mail.dll require the scope: https://mail.google.com?
If you want to use IMAP/POP3/SMTP and OAuth2 authentication with Gmail, this is the scope you should be using.
You can find more details on how to use OAuth2, Gmail and Mail.dll here:
Alternatively you can use less secure apps or application specific passwords .
VAT: PL 5213195875
02-707, Warsaw Poland