 <?php
 $email=trim($_REQUEST['email']);
$key=trim($_REQUEST['key']);

if($key ==1)
{
	if($email !='')
	{
	$content="$email"."\n";
	$myFile = "unsub.txt";
	$fh = fopen($myFile, 'a') or die("Your Email-ID, $email has been noted for unsubscription. It will take 48 hours to process your request. Thank you for using our service.");
	fwrite($fh,$content);
	fclose($fh);
	
	echo "Your Email-ID, $email has been noted for unsubscription. It will take 48 hours to process your request. Thanks for using our service.";
	}
}
if($key ==2)
{ 
 
$firstname=$_REQUEST["firstname"];
$email=$_REQUEST["email"];
$stringData = $firstname."|". $email ."\n";
$fp = fopen($path,"a+");
fwrite($fp,$stringData);
fclose($fp);
echo "$email has been noted for unsubscription. It will take 48 hours to process your request. Thanks for using our service.";


	if($email !='')
	{
		

   
     $to = $_POST['email'];
	 $subject = "Verify your Unsubscription";
	 $message = "Hello $firstname,
	

Your Email-ID, $email has been noted for unsubscription. It will take 48 hours to process your request. Thank you for using our service

This message was sent to you by easywayhealthy.com(easywayhealthy.com)
You received this message because you requested a unsubscription to the feed,
Update from easywayhealthy.com

If you received this in error, please disregard. Do not reply directly to
this email.
";


	  mail($email, $subject, $message, null,'-feasywayhealthy.com<healthtips@easywayhealthy.com>');

     }
}

?>