User attribute & Email

HI Support,

I am trying to configure the email notification for the vmcreation through hook,how to add the email for the users and how to use it in email attributes in hook? ,if possible can you share the ruby script to send the email notification to users.