PHP mail test from localhost

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

$from = "foo@example.com";
$to = "bar@example.com";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;

$state = mail($to, $subject, $message);

echo "Test email sent: $state";
?>

# Link
http://php.net/manual/de/function.mail.php