Use plugin php script then the submit button triggered

I never write a grav plugin before, so sry if my question is trivial.

My issue is to write a plugin to validate if an email is correct or not. The script is finish now and I would like trigger it when users submit a form on my website. I read the documentation but still don’t know it.

The function:

verifyEmail($toemail) {

Thank you in advance