|
function checkEmail($email) {
// checks proper syntax
if(preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $email)) {
// gets domain name
list($username,$domain)=split('@',$email);
// checks for if MX records in the DNS
if(!checkdnsrr($domain, 'MX')) {
return false;
}
// attempts a socket connection to mail server
if(!fsockopen($domain,25,$errno,$errstr,30)) {
return false;
}
return true;
}
return false;
}
if($_POST["name"] != null && $_POST["email"] != null)
{
if(!checkEmail($_POST["email"]))
{
$msg = sprintf("Ad Soyad: %s\nMail: %s\nTelefon: %s",
$_POST["name"],
$_POST["email"],
$_POST["tel"]);
$sendmail = mail("info@abckalite.com",
"Yeni Mail Kaydı",
$msg,
"From: info@abckalite.com");
if($sendmail)
echo "Teşekkürler...";
else
echo "Bir hata oluştu.";
}
else
{
die("Hatalı email");
}
}
else
{
?>
| |
|
|