How do i generate token for each user they submit my custom form? I have a created a custom module with simple form with only three fields ( Url, title &amp; email ) , where user has to enter all the fields for submission.



I am able to send the mail to the user from my custom module but i need to create and attach a validation link (possibly with unique token for unique email) how do i generate a token so i can store it in database and use it for validating the user later. 

(you may also help me with your own approach)
1.Declare custom tokens using hook_token_info()


2.Create custom tokens using hook_tokens()



3.You can use your custom tokens using token_replace()
that is call the token_replace at the place where u need to send the email.

4.Create a seperate file inside your module with .tokens.inc extension and include the hook_tokens_info() and hook_tokens() inside it.