To troubleshoot, remove the redirect from UE, change:
$GoToPage = "thank-you.html"
to:
$GoToPage = ""
add the following code at line 1 to turn on error reporting:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
Then add the following code in the body tag:
<?php @session_start(); var_dump($_SESSION); ?>
this will write the session contents to the page including the email message, send a link where i can test the email after making those changes.