Email notifications on Readynas Duo v2 using gmail and 2-step verification

I had some problems enabling email alerts on my Netgear Readynas Duo v2 (firmware 4.1.14) using Googles Gmail as email provider. Then I remembered that I use 2-factor verification. This is how I solved it:

Go to System -> Warnings -> Contacts to fill out your contact information. Add Gmail as email provider. Fill in your Google/Gmail login credentials, and use your email address as sender address. I guess you could use any string here, but just to be safe and not get caught by the anti spam filter I choose to use my email address.

Netgear Readynas Email notification settings
Netgear Readynas Email notification settings

Press Send Test Message. Voila, nothing happens. Why? You need to generate an app password when you use Gmail with 2-step verification. Go to https://myaccount.google.com/ to manage your app passwords.

Google Connected apps & sites
Google Connected apps & sites

Click on Connected Apps & Security, and then Manage Apps.

Google Connected apps & sites app passwords
Generating app password at Google Connected apps & sites

Click on Select App and choose Other (Custom Name). Give the new app a descriptive name and click Generate. Google will now generate an app password for you.

Google apps generated app password
Google apps generated app password

Copy the password and go back to your Readynas and paste the password in the password field. Press Send Test Message and then check your email. Voila! You have an email from your Readynas there.