1 - Your program should make a unique ID based on user computer hardware. You can use this article:
Searching for a reliable hardware ID
2 - User should send this code to your mail, then you send him/her, the activation serial number.
But it’s better to make a website. Then user can enter his Hardware ID and your website can give him/her the activation code after checking hardware serial number and other criteria.