How to automatically generate a ticket number and send it in thank you email to the users?