This can (and should) be achieved using the admin_post
action. Take a look at the docs for an example:
https://codex.wordpress.org/Plugin_API/Action_Reference/admin_post_(action)
SitePoint also have a more comprehensive tutorial here:
https://www.sitepoint.com/handling-post-requests-the-wordpress-way/
Hope that helps.