Gmail’s authentication is secured by rejecting access from less secure apps. By default, adding Gmail SMTP in Thunderbird with your Google account password as SMTP authentication password will not work. And Google is beginning to shut off Google Account access to less secure apps.
To solve this, the method is to use OAuth2 authentication instead of the password based authentication.
To add Gmail SMTP, in Thunderbird’s "Account Settings", select "Outgoing Server (SMTP)" and then click the "Add" buttion. The key parts are in the settings as follows.
<your full gmail address>
Here, the "Authentication method" must be "OAuth2". After you clicking "OK", a browser window will show and you can login using your Google account to authentication and authorize your Thunderbird client to access your Gmail account. After it is set, Gmail SMTP should start to work for your Thunderbird.