WP Access to Template Tags

I make a form in a Custom Template in my WordPress Theme. I submit the form to a PHP script in the theme directory via bloginfo ( ‘template_directory’ ). I want to be able to generate an email and have it sent to the admin email address that’s set in the WP installation. How can I access the Template Tags in the stand-alone submission script? By pure dumb luck I found the right two lines of code to paste into my script:

require_once ( $_SERVER[ 'DOCUMENT_ROOT' ] . '/wp-load.php' );
 wp ();

Now I created a reusable script that I can drop into any WordPress Theme by inserting the Site Name via get_bloginfo ( ‘name’ ) into the subject and sending the email to the Site Admin via get_bloginfo ( ‘admin_email’ ).

Links

WordPress.org/Template_Tags
PHP.net/mail-function