Your code has a few abnormalities, may not necessarily effect the security but they might well be considered bad practice. And also make it very hard to read 😉
$name = $_POST[name];
// $_POST values should be in quotes
$name = $_POST['name'];
if (($_SERVER['HTTP_REFERER'] != 'http://www.mydomain.com/mycontactform.php') and ($_SERVER['HTTP_REFERER'] != 'http://www.mydomain.com/mycontactform.php' ))
// I might be tired but that looks like you are doing that twice.
// kind of like saying if 1 is not 2 and 1 is not 2
if ($_SERVER['HTTP_REFERER'] != 'http://www.mydomain.com/mycontactform.php')
$send = "no";
// why not use a boolean?
$send = false;
// then you can do simple things like
if($send)
// rather than
if($send == "yes")
//Remove any newlines from input email address
else if($email)
{preg_match("/(%0A|%0D|\\n+|\\r+)/i", $email) == 0;}
else if($email)
// Remove any email headers from mail form input
{preg_match("/(content-type:|to:|cc:|bcc/i", $email) == 0;}
// You have some strange email checking at the end, there is no way the code will reach both of these, since they have the same entry requirement the first will be executed. Also, "else if($email)" says is $email true? and a string always converts to true unless its empty.
Hope that helps somehow or other 😛