You save yourself the trouble of making an HTTP request from your server to your own server. It's like walking out the front door of your house and getting into the back door in order to go from the living room to the kitchen. In technical terms it's slow and marginally less secure.
Your program should be broken into several modules, each being able to interact with each other within the same environment. You could break your program into a generate_template($vars) function and a verify_email($address, $code) function among others that do different tasks, then you would do the following:
$verified = verify_email($_POST['email'], $_POST['verification_code']);
$vars = [
'title' => 'Something',
'name' => 'Something'
$to = $_POST['email'];
$subject = 'Email subject';
$body = generate_template($vars);
send_an_email($to, $subject, $body);
This is, of course, very simplified, but the verify_email(), generate_template(), send_an_email() functions can be used anywhere on your site, just put them in a file and include the file where needed. I usually make more complex programs and use objects with properties and methods rather than just functions. These objects can be used on many different pages, each page just has to include the objects that it needs.