<?php
require("class.phpmailer.php");

if (isset($_REQUEST['signin'])) {




//email start

		  $name = $_REQUEST['Name'];
		  $email=$_REQUEST['Email'];
		  $phone=$_REQUEST['Phone'];
		  $place=$_REQUEST['Place'];
		
		
	$message1="<div class='m_104079662620680419bodyWrapper'>
<div style='width:767px;margin:auto'>
<div style='padding:18px 0 10px 73px'></div>
</div>
<div style='height:8px;margin-bottom:15px'></div><div style='width:621px;margin:auto;padding:0 73px 10px 73px'><div style='padding:17px'><p style='margin:0;padding:0'>Dear ".$name.", </p>";


$message1.="<p>Thank you for completing the Form.</p>
    	 <p>You have submitted follwing details:</p>
			<p><span>Name: ".$name."</span></p>
			<p><span>Email: ".$email."</span></p>
			<p><span>Phone: ".$phone."</span></p>
			<p><span>Place: ".$place."</span></p>
			";


$message1.="
<div style='font-weight:400;width:150px;padding-bottom:40px'><p><b>Thankyou,</b></p><p><b>RGF INDIA</b></p></div></div>
<p>&nbsp;<br></p>
</div></div>";

	



			$to = array($email);
			$fromEmail= "info@rgfindia.com";

			$fromName="RGF INDIA";


			$subject="Sadbhavana Pledge";

			$message = $message1;

			//Set basic detail here			
			$domain = "iyc.in";

			$smtpHost = "iyc.in";

			$smtpUser = "smtp@$domain";

			$smtpPassword = "smtp@2020#";


			

			$mail = new PHPMailer();

			$mail->IsSMTP();              // set mailer to use SMTP



			$mail->Host = $smtpHost;  // specify main and backup server

			$mail->SMTPAuth = true;     // turn on SMTP authentication

			$mail->Username = $smtpUser;  // SMTP username

			$mail->Password = $smtpPassword; // SMTP password



			$mail->From = $fromEmail;

			$mail->FromName = $fromName;

			foreach ($to as $toAddress) 

			{

				//$toAddress;

				$mail->AddAddress($toAddress, "");

			}

			$mail->IsHTML(true);               // set email format to HTML

			$mail->Subject = $subject;

			$mail->Body    = $message;

			$mail->AddBCC("rajivsadhbhavana@gmail.com","");

			if(!$mail->Send())
			{
			  echo "Message could not be sent. <p>";

				echo "Mailer Error: " . $mail->ErrorInfo;

			     exit;
			}

			//email end
			if($_REQUEST['formtype']=="Hindi")
			{
			    header("location:certificate-hindi.php?name=".$name."");
			}
			else
			{
		    	header("location:certificate-english.php?name=".$name."");
			}
			
}
else
{
    header("location:http://rgfindia.org/pledge/");
}

?>