Populate a form through scripting

Populate a form through scripting

I have a function that sends an email to an admin email address and the user email address whenever the user's record is updated. I want to be able to keep track of who sent what email when, though and save all of that information in a table. Is there any way of doing this?