I would like to have the same message for forms on web applications. How exactly do you do it?
When you have the mail form open and try to close the window without saving the message pops up:
"Are you sure you want to navigate away from this page?
You will lose any unsaved edits.
Press OK to continue, or Cancel to stay on the current page."
If you click Cancel you stay on the same page.