This video explains the process very clearly: Set up Scan to Email HP Printer with 2 Step Verification on **bleep** and Google - YouTube
Text Version provided by @ShlomiL
First, open the following link and login to the same account as you set for the printer.https://myaccount.google.com/securityWithin the Signing in to Google section, be sure to turn on "2-Step Verification":
Next, create and use an App-Specific Password to be used with the printer:https://support.google.com/accounts/answer/185833?hl=en
Once completing the changes update the outgoing email profile password to use the App Specific Password and then click Save and Test to ensure the problem has been resolved.