<?php

function spamcheck($field)
  {
  //filter_var() sanitizes the e-mail
  //address using FILTER_SANITIZE_EMAIL
  $field=filter_var($field, FILTER_SANITIZE_EMAIL);

  //filter_var() validates the e-mail
  //address using FILTER_VALIDATE_EMAIL
  if(filter_var($field, FILTER_VALIDATE_EMAIL))
    {
    return TRUE;
    }
  else
    {
    return FALSE;
    }
  }

if (isset($_REQUEST['email']))
  {//if "email" is filled out, proceed

  //check if the email address is invalid
  $mailcheck = spamcheck($_REQUEST['email']);
  if ($mailcheck==FALSE)
    {
    header('Location: index.php');
    }
  else
    {//send email
	$email = strip_tags($_POST['email']);
	$message = strip_tags($_POST['message']);
    mail( "shanaka.sr@gmail.com", "News Letter",
"Email: $email",
"From: Forms <info@epicfive.net>"  );	
	header('Location: index.php');
    }
  }
?>