You can't if it's a free game because you won't have a list of email addresses.
If it's a paid game you can use software to send a key to everyone's email address, but it won't be an automatic system.
Alternatively, you can use automated email-sending software like MailChimp and have people sign up to receive a free key. They must voluntarily sign up and authenticate their email addresses. Afterwards you'll have a list of email addresses. You will need to have a privacy policy to state what you will do with those email addresses. You can set up this type of software to automatically send a key when someone signs up.