What you have here is a script that should work if all the input is correct, but it gives no feedback to the user. As a very basic version that does provide such feedback:
<?php
if (isset($_POST['name'], $_POST['subject'], $_POST['message']))
{
$mailTo = 'info@domainname.com';
$mailFrom = $_POST['name'];
$subject = $_POST['subject'];
$message = $_POST['message'];
if (mail($mailTo, $subject, $message, "From: " . $mailFrom))
{
echo 'Mail sent!';
}
else
{
echo 'Mail could not be sent.';
}
}
else
{
echo 'The name, subject or message was not provided.'
}
Note that just because the mail is successfully sent does not mean that it will be successfully received. Furthermore, be careful that you do not allow your script to be used for spamming. (Hence you would have some form of access control and flood control.)