If you need to send email using the Gmail service, you need to obtain an application password. Get yourself a key from https://support.google.com/accounts/answer/185833 and try the operations again after inserting it into your code.