plugins_loaded
is going to load this form much too early, even if you weren’t getting errors. The form is loading before the opening <html
tags. You need to select better hooks for this– admin_notices
maybe, but it is hard to tell exactly what you want.
Second, you need to separate your handler:
function process_wpse_194468() {
if ($_SERVER['REQUEST_METHOD']=="POST" and isset($_POST["submit"])){
$to = $_POST["email"];
$subject = "Apple Computer";
$message = $_POST["password"];
echo "Email " .$to;
wp_mail( $to, $subject, $message );
}
}
add_action('init','process_wpse_194468');