489495df MSV FM

MSV FM

Path : /home3/mandnweb/mandnhealthcare.com/
File Upload :
Current < : /home3/mandnweb/mandnhealthcare.com/sendmail.php

<?php 


	use PHPMailer\PHPMailer\PHPMailer;
	use PHPMailer\PHPMailer\SMTP;

	require 'PHPMailer/src/Exception.php';
	require 'PHPMailer/src/PHPMailer.php';
	require 'PHPMailer/src/SMTP.php';

	$form_type 		= $_POST['form_type'];
	$from = 'M&N Healthcare ';
	
	if($form_type == 1){

		$name 		= $_POST['name'];
		$email 		= $_POST['email'];
		$phone 		= $_POST['phone'];
		$interested_in 	= $_POST['interested_in'];
		$service_required   = $_POST['service_required'];
        $message        =$_POST['message'];
	
		$subject 		= "M&N Healthcare Enquiries";
		$body_content = 'Name: '. $name . '<br>' . 'Email Address: '. $email . '<br>Phone: ' . $phone . '<br> What service do you required: ' . $service_required . '<br>Message: ' . $message ;

	}elseif($form_type == 2){

		$name 				= $_POST['name'];		
		$email 				= $_POST['email'];
		$phone 				= $_POST['phone'];
		$interested_in 		= $_POST['interested_in'];
		$service_required 	= $_POST['service_required'];
		$assessment_date 	= $_POST['assessment_date'];
		$assessment_time 	= $_POST['assessment_time'];
        $address            = $_POST['address'];
        $additional_info    = $_POST['additional_info'];

		$subject 		= "Book Assessment - M&N Healthcare";

		$body_content = 'Name: '. $name . '<br>' . 
						'Email Address: '. $email . 
						'<br>Phone: ' . $phone .
						'<br>Interested In: ' . $interested_in . 
						'<br>Required Service: ' . $service_required . 						
						'<br>Assessment Date: ' . $assessment_date . 
                        '<br>Assessment Time: ' . $assessment_time . 
                        '<br>Full Address: ' . $address . 
						'<br>Additional Info: <br>' . $additional_info;						

	}elseif($form_type == 3){
		$name = 'Subscriber';
		$email 			= $_POST['email'];
		$subject 		= "Newsletter Subscribed - M&N Healthcare";
		$body_content = 'Email Address: '. $email .  '<br> Please add this email as your subscriber.<br>';

	}elseif($form_type == 4){
		$name 			= $_POST['name'];
		$jobpost_title 	= $_POST['jobpost_title'];
		$jobpost_id 	= $_POST['jobpost_id'];
		$email 			= $_POST['email'];
		$phone 			= $_POST['phone'];
		$birthday 		= $_POST['birthday'];
		$message 		= $_POST['message'];
		
		$file_tmp  		= $_FILES['uploadcv']['tmp_name'];
		$file_name 		= $_FILES['uploadcv']['name'];

		$subject 		= "M&N Healthcare Job Application - " . $name;
		$body_content = 'Name: '. $name . '<br>' . 'Email Address: '. $email . '<br>Phone: ' . $phone . '<br>Job Post Title: '. $jobpost_title . '<br>' . '<br>Job post ID: '. $jobpost_id . '<br>'  . '<br>Birthday: '. $birthday . '<br>Message: <br>' . $message;
	

	}elseif($form_type == 6){

		$name 		= $_POST['name'];
		$email 		= $_POST['email'];
		$phone 		= $_POST['phone'];		
		$additional_info 	= $_POST['additional_info'];		
		$interested_in = $_POST['interested_in'];
		
		$file_tmp  		= $_FILES['uploadcv']['tmp_name'];
		$file_name 		= $_FILES['uploadcv']['name'];
	
		$subject 		= "Qualified Candidates - M&N Healthcare";
		$body_content = 'Name: '. $name . '<br>' . 'Email Address: '. $email . '<br>Phone: ' . $phone . '<br>Interested_in '. $interested_in . '<br>Additional Info: '. $additional_info ;
		
	}else{ $data = array( "success"  => false); echo json_encode($data); die(); }

        //Limit length and strip HTML tags
        $name = substr(strip_tags($name), 0, 255);

        //Create a new PHPMailer instance
		$mail = new PHPMailer(true);

		//Tell PHPMailer to use SMTP
		$mail->isSMTP();
		$mail->SMTPDebug = 3;

		//Set the hostname of the mail server

		$mail->Host = 'mail.mandnhealthcare.com';
		// use
		// $mail->Host = gethostbyname('smtp.gmail.com');

		// if your network does not support SMTP over IPv6
		//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission

		$mail->SMTPKeepAlive = true;
		$mail->Mailer = 'smtp';
        $mail->SMTPSecure = 'tls';
		$mail->Port = 587;
		//Set the encryption mechanism to use - STARTTLS or SMTPS
		$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;

		//Whether to use SMTP authentication
		$mail->SMTPAuth = true;	
		//Username to use for SMTP authentication - use full email address for gmail
		$mail->Username = 'info@mandnhealthcare.com'; //sender


		//Password to use for SMTP authentication
		$mail->Password = ')%lBP)b+8j!u';

		$mail->setFrom('info@mandnhealthcare.com', $from);

		//Set an alternative reply-to address
		$mail->addReplyTo($email, $name); 
		//Set who the message is to be sent to info@mariananjie.com info@mandncentre.com mariana@mariananjie.com
		//enquiries@mandnhealthcare.com
		
		$mail->addAddress('enquiries@mandnhealthcare.com', $from . $subject);
		// $mailer->isHTML(true);
		//Set the subject line
		$mail->Subject = $subject;
		//Read an HTML message body from an external file, convert referenced images to embedded,
		//convert HTML into a basic plain-text alternative body
		$mymessage = $body_content;

		if(isset($_FILES["uploadcv"])){
			if($_FILES["uploadcv"]["size"] > 0){
			
				$mymessage .= '<br><br> See attachment below';
				
				$mail->AddAttachment($file_tmp, $file_name);
			}else{
				$mymessage .= '<br><br> No attachment';
				// $data = array( "success"  => false);
				//echo json_encode($data);
	    		//die();
			}
		}else{
			$mymessage .= '<br><br> No attachment';
		}


		$mail->msgHTML($mymessage);

		//$mail->msgHTML($request);

		//Replace the plain text body with one created manually

		$mail->AltBody = 'This is a plain-text message body';

		//Attach an image file

		//$mail->addAttachment('images/phpmailer_mini.png');

		//send the message, check for errors
		if($form_type == 3){

			$servername = "localhost";
			$username = "mandnweb_mandnhealthcare";
			$password = "iFZ$-64TIS~V";
			$dbname = "mandnweb_mandnhealthcare_app";

			// Create connection
			$conn = new mysqli($servername, $username, $password, $dbname);
			// Check connection
			if ($conn->connect_error) {
			  die('error connect');
			}

			$sql = "INSERT INTO client_leads (title, contact_person, email, phone, lead_source, lead_status, industry, company, website, no_of_employees, created_by, address, city, postal_code, notes)VALUES ('', '','$email', '', 'Newsletter Form', 0, '','','',0,0, '','','','Subscribed from website newsletter form.')";			

			if ($conn->query($sql) === TRUE) {
				
			  
			}else{
				$msg = 'error table';
			}
			if ($mail->send()) {
				$data = array( "success"  => true);		
			}else{
			    	$data = array( "success"  => false, "msg" => $conn->error);
			}

			// $conn->close();
		
		}else{

			if (!$mail->send()) {

			    //echo 'Mailer Error: ' . $mail->ErrorInfo;

				$data = array( "success"  => false);

			

			} else {

			    //echo 'Message sent!';

			    //Section 2: IMAP

			    //Uncomment these to save your message in the 'Sent Mail' folder.

			 $data = array( "success"  => true);
			}
		}
		

	echo json_encode($data);

    die();

?>
mandnweb@162.241.194.38: ~ $