This block of code can never run because it requires that $type have a value (only value it can have in the admin_email context is 'log') AND that the form has been submitted. Because the form definition does not include a hidden field for 'type', the type value that originally came from emaillog.php as a GET param will never make it through to the form processing code.