<?php
include('data_handler.php');
$safeval = $_POST;
if(isset($safeval['datatype']) && $safeval['datatype'] == 'sbEmp') {

	if($safeval['action'] == 'sbemp_get_data') {
		
		require_once('swift/swift_required.php');
		
		$transport = Swift_MailTransport::newInstance();
		$mailer = Swift_Mailer::newInstance($transport);
		$safeval['name'] = stripslashes($safeval['name']);
		$safeval['name'] = stripslashes($safeval['name']);
		$safeval['company'] = stripslashes($safeval['company']);
		$safeval['company'] = stripslashes($safeval['company']);
		$safeval['email'] = stripslashes($safeval['email']);
		$safeval['address'] = stripslashes($safeval['address']);
		$safeval['address'] = stripslashes($safeval['address']);
		$safeval['city'] = stripslashes($safeval['city']);
		$safeval['state'] = stripslashes($safeval['state']);
		$safeval['zip'] = stripslashes($safeval['zip']);
		$safeval['job'] = stripslashes($safeval['job']);
		$safeval['salary'] = stripslashes($safeval['salary']);
		$safeval['education'] = stripslashes($safeval['education']);
		$safeval['experience'] = stripslashes($safeval['experience']);
		$safeval['job_description'] = stripslashes($safeval['job_description']);
		$safeval['job_description'] = stripslashes($safeval['job_description']);
		$subject = "Klamath Works Employer Form";
		$message = "<div style='font-family:arial,verdana;font-size:14px;color:#666666;'>
		<p>This email is from the employer form on klamathworks.com. </p>
		<p><b>Name:</b> $safeval[name]</p>
		<p><b>Company:</b> $safeval[company]</p>
		<p><b>Email:</b> $safeval[email]</p>
		<p><b>Address:</b> $safeval[address]</p>
		<p><b>City:</b> $safeval[city]</p>
		<p><b>State:</b> $safeval[state]</p>
		<p><b>Zip:</b> $safeval[zip]</p>
		<p><b>Job Title:</b> $safeval[job]</p>
		<p><b>Salary Range:</b> $safeval[salary]</p>
		<p><b>Required Education:</b> $safeval[education]</p>
		<p><b>Experience Level:</b> $safeval[experience]</p>
		<p><b>Job Description:</b> $safeval[job_description]</p>
		</div>";
		
		//Email Setup
        $from = array("admin@klamathworks.com" => "Admin");
		if($safeval['email'] != '') $from = array($safeval['email']=>$safeval['name']);
		$to = 'theworks@klamathworks.com@teamklamath.com';
		//$to = 'davidj@smithbates.com';
		$copy = array('davidj@smithbates.com');
		
		$content = Swift_Message::newInstance($subject)
					->setContentType("text/html")
					->setFrom($from)
					->setTo($to)
					->setBody($message);
					if(isset($copy)) $content->setBcc($copy);
					$headers = $content->getHeaders();
		$sendIt = $mailer->send($content);
	}
}

?>
