 <?php include("header.php"); ?>
<div class="wrapper"> 
	<div class="section">
	   <!--div class="contact-banner container-fluid " style="background-image: url(assets/img/contact.jpeg);">
	   </div>
	   <h2 style="text-align:center;">For investor relations at Y M Y Capital, please contact us using the information below. </h2-->
	   <div class="container">
		   <div class="row">
		   	<img src="assets/img/contact.jpeg" style="width:100%;margin: 150px 0px 30px 0px;" />

			   <!--<div class="col-md-12">
					<div class="col-md-3" style="margin-left: 38.666667%;">
						<a class="btn btn-info btn-fill" href="brochure.pdf" download>
							<p style="text-align:center;margin:0;">Download brochure</p>
						</a>
					</div>-->
					<form role="form" id="contact-form" method="post">
						<div class="col-md-12">
							<div class="form-group">
								<label for="name">Your name</label>
								<input type="text" name="name" class="form-control" id="name" placeholder="First Name and Last Name"/>
							</div>
						</div>
						<div class="col-md-6">
							<div class="form-group">
								<label for="email">Email address</label>
								<input type="email" name="email" class="form-control" id="email" placeholder="Your personal email address"/>
							</div>
						</div>
						<div class="col-md-6">
							<div class="form-group">
								<label for="phone">Phone</label>
								<input type="text" name="phone" class="form-control" id="phone" placeholder="Phone number"/>
							</div>
						</div>
						<div class="col-md-12">
							<div class="form-group">
								<label for="message">Your message</label>
								<textarea name="message" class="form-control" id="message" rows="6"></textarea>
							</div>
							<div class="submit">
								<input type="submit" class="btn btn-info btn-fill" value="Connect" />
							</div>
						</div>
					</form>
			   </div>
		   </div>
	   </div>
    </div><!-- section -->
    


<?php
	// Import PHPMailer classes into the global namespace
	require 'PHPMailer/src/PHPMailer.php';
	require 'PHPMailer/src/Exception.php';
	require 'PHPMailer/src/SMTP.php';
	// These must be at the top of your script, not inside a function
	use PHPMailer\PHPMailer\PHPMailer;
	use PHPMailer\PHPMailer\Exception;

	// Load Composer's autoloader
	//require 'vendor/autoload.php';

	if (isset($_POST['name'],$_POST['email'],$_POST['message']))
	{	
		
		$name  =  (string)$_POST["name"];
		$email	=  (string)$_POST["email"];
		$phone  =  (string)$_POST["phone"];
		$message  =  (string)$_POST["message"];
// 		info@ymysolutions.com
		
		$email_to = "ashokgrandhi2@gmail.com"; // your email address
		$email_subject = "{SUBJECT}"; // email subject line
		$thankyou = "{thankyou.php}"; // thank you page
		
		// Instantiation and passing `true` enables exceptions
			$email_message = "Form details below.\r\n";
	
			function clean_string($string) {
			  $bad = array("content-type","bcc:","to:","cc:");
			  return str_replace($bad,"",$string);
			}
			
			$email_message .= "Full Name: ".clean_string($name)."\r\n";
			$email_message .= "Email: ".clean_string($email)."\r\n";
			$email_message .= "Telephone: ".clean_string($phone)."\r\n";
			$email_message .= "Message: ".clean_string($message)."\r\n\r\n".base64_decode($base)."\r\n";
			
			$headers = 'From: '.$email."\r\n".
			'Reply-To: '.$email."\r\n" .
			'X-Mailer: PHP/' . phpversion();
			mail($email_to, $email_subject, $email_message, $headers);
		//	header("Location: $thankyou");
		//	echo "<script>location.replace('$thankyou')</script>";
	}

?>

