Two things to try. I had the same issue with Yahoo. So I'm assuming it's the same for Gmail.
Go to Accounts in Mail
in your Gmail account select: 'outgoing mail server' drop down menu
Select: edit SMTP
And, it will bring up a new window that should allow for the password field to be input.
Hope that helps.
Also, if it's Malware, which mine also had. Here's how to fix the issue.
Follow these instructions:
Go to: https://www.malwarebytes.org
Park your mouse over ’Downloads' in the upper left menu of the page, not the ‘Downloads' link in the middle of the page.
And, click ‘Products’ in the drop down menu.
Once new page the comes up, scroll down to the worm in the apple image and click ‘download’ - Malwarebytes Anti-Malware for Mac Free
Then, click ‘Download Now’
Then, ‘Open’
Then, follow instructions to install by dragging it to applications - the window that pops up will instruct you.
Then, search your computer for ‘malwarebytes’ and open it.
It will install and ask you to accept, etc.
Click ‘Scan’ when Malware window pops up. It takes ten seconds.
If it finds issues it will bring up a new window and ask if you want to remove those items.
Do that if it finds them.