MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/absoluteresultstechnologies.net/public_html/ramclearout/
File Upload :
Current < : /hermes/bosweb/b1705/absoluteresultstechnologies.net/public_html/ramclearout/email.php

<?php
	session_start();
	
	if(isset($_GET['regID']))
	{
		/*
		$link = mysql_connect('legacymotivation.netfirms.com', 'u70814874', '561ea0')
		    or die('Could not connect: ' . mysql_error());
		mysql_select_db('d60744927') or die('Could not select database');
		
		$sql = 'SELECT * FROM registeryourcaravan WHERE regID = ' . $_GET['regID'];
		$info = mysql_fetch_assoc(mysql_query($sql));
		*/
		
    	$info = unserialize(stripslashes(urldecode($_GET['regID'])));
    	$info['dealer'] = $info['selectedDealer'];
    	  	         
    	include_once('includes.php');       
		if($dealerInfo[$info['dealer']]['eventID'] != "")
		{
			$_GET['promo'] = 'RAM Clearout';
			$_GET['eventID'] = $dealerInfo[$info['dealer']]['eventID'];
			$_GET['source'] = 'web';
			$_GET['lastName'] = $info['lastname'];
			$_GET['firstName'] = $info['firstname'];
			$_GET['mobilePhone'] = $info['mobile'];
			$_GET['email'] = $info['email'];
			$_GET['address'] = $info['address'];
			$_GET['postalCode'] = $info['postalCode'];
			$_GET['currentVehicleYear'] = $info['years'];
			$_GET['currentVehicleModel'] = $info['makes'] . ' ' . $info['models'];
			$_GET['currentVehicleKM'] = $info['kilometers'];
			$_GET['nextVehicleModel'] = $info['nextVehicle'];
			$_GET['notes'] =  '$' . $info['payment'] . '/mth - ' . $info['monthsRemaining'] . ' Mths Remaining - Worth $' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']);
			
			$_GET['requiredUpdates'] = array();
			if($info['mobile'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('mobilePhone'));
			if($info['email'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('email'));
			if($info['years'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('currentVehicleYear','currentVehicleModel','currentVehicleKM','email','mainPhone'));
			if($info['nextVehicle'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('nextVehicleModel'));
			if($info['address'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('address'));
			if($info['postalCode'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('postalCode'));
			$_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('notes'));
			
			include_once('../misc/rsvp.php');
			//include_once('adfEmail.php');
		}	      
		                 
		$_SESSION['registerEmail']['dealerInfo'] = $dealerInfo;
							 
    	include_once('displayUtils.php');        	
		include_once('Emailer/swift_required.php');	
		
		try 
		{			
			$transport = Swift_SmtpTransport::newInstance('server519.appriver.com');
			$mailer = Swift_Mailer::newInstance($transport);
			
			$message = Swift_Message::newInstance($dealerInfo[$info['dealer']]['name'] . " 2012 Model Clearout Confirmation");	
			
			$body = '
					 <font style="font-size:10pt;font-family:Arial">
					 	Dear ' . $info['firstname'] . ',
					 	<br><br>
					 	Thank you for your registration!
					 	';
			
			if($info['values']['tradeInLow'] != "" && $info['values']['tradeInLow'] != 0)
			{

				//NO BLACK BOOK VALUE (must complete all the form)	
					if(in_array($info['dealer'],array('orleansdodge', 'camrose','wille')))
					{
					}
		
					else {
						$body .= '
							 	<br><br><b>
							 	<font style="font-size:11pt">
							 	According to Canadian Black Book,
							 	</font>
							 	<br>
							 	<font style="font-size:13pt">
							 	Your ' . ucwords($info['years'] . ' ' . $info['makes'] . ' ' . $info['models']) . '  Is Worth <u>$' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']) . '</u>
							 	</font>
							 	</b>
							 	';
					}
			}
	
		// NO VOUCHER
			if(in_array($info['dealer'],array('rainbow','oconnor','orleansdodge','camrose','leamington','bustard','lakehuron','bayview','islington','galt','ontario','atlantic','bayking','dewildt')))
			{
					$body .= '
							<br><br>';
			} 
		// END NO VOUCHER

		else 	
		{
		$body .= '
						<br><br>
						
					 	Your Savings Certificate is attached to this email.<br>Please print and bring with you to the dealership. 
					 	<br><br>';
		} 
	

					 	
		if(in_array($info['dealer'],array('jackson','renfrew','norlan','brabymotors','northyork','capitaljeep','johnston','raceway','ensign','abbotsford','sevenview','lapointe','yellowknife','regency100','pioneer','renfrewchrysler','pembinavalley','coldlake','bonnyville','oconnor','capitaljeep','parksvillechrysler','regencyquesnel','muskoka','embrun','downsview','moncton','maclangsun','wendell','lakeview','parkers','oakville','pickering','bustardwaterloo', 'camrose','halifax','steele','bowmel','bustard','riverside','bayview','galt','bayking')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a Tim Horton\'s Gift Card!</font></b>
						<br><br>
						';
			}			 	
			else if(in_array($info['dealer'],array('grovedodge')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a Grove Dodge Rewards Card!</font></b>
						<br><br>
						';
			}		


else if(in_array($info['dealer'],array('islington')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a Walmart Gift Card!</font></b>
						<br><br>

						';
			}		

			else if(in_array($info['dealer'],array('ontariochrysler')))
			{
				$body .= '

					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: For every purchase on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' receive a $200 Gas Card!</font></b>

						<br><br>
						';
			}		


			else if(in_array($info['dealer'],array('brantford')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a $10 Esso Gas Card!</font></b>
						<br><br>
						';
			}

			else if(in_array($info['dealer'],array('eastway')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a $25 Esso Gas Card!</font></b>
						<br><br>
						';
			}	
	
			else if(in_array($info['dealer'],array('columbia')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a Gift!</font></b>
						<br><br>
						';
			}		

	
			else if(in_array($info['dealer'],array('legacy','peel','hunt','langley')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a Free Gift Card!</font></b>
						<br><br>
						';
			}		

	else if(in_array($info['dealer'],array('dartmouth')))
			{
				$body .= '
					 	<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and receive a Subway Gift Card!</font></b>
						<br><br>
						';
			}	

	else if(in_array($info['dealer'],array('derrickdodge')))
			{
				$body .= '
					 	<br /><br /><b><font style="color:blue;font-size:11pt">JUST ANNOUNCED:</b> <span style="color:red"> UP TO $1000 HOLIDAY BONUS CASH </span>on qualifing new vehicles!!</font></b>

						';
			}	


			if(in_array($info['dealer'],array('orleansdodge')))
			{
$body .= '
					 	<table cellspacing="0" cellpadding="0">
						 	<tr>
						 		<td style="font-size:10pt;font-family:Arial;padding:10px 0px">
						 			
						 			<b>Name:</b> ' . $info['firstname'] . ' ' . $info['lastname'] . '<br>
						 			<b>Email:</b> ' . $info['email'] . '<br>
						 			<b>Mobile:</b> ' . $info['mobile'] . '<br>
						 			<b>Address:</b> ' . $info['address'] . ' ' . $info['postalCode'] . '<br>
						 			<b>Year:</b> ' . $info['years'] . '<br>
						 			<b>Make:</b> ' . $info['makes'] . '<br>
						 			<b>Model:</b> ' . $info['models'] . '<br>
						 			<b>Trim:</b> ' . $info['trims'] . '<br>
						 			<b>Style:</b> ' . $info['styles'] . '<br>
						 			<b>KM:</b> ' . $info['kilometers'] . '<br>
						 			<!-- <b>Trade in Value:</b> '. ($info['values']['tradeInLow'] != "" && $info['values']['tradeInLow'] != 0 ? '$' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']) : '') . '
						 			<br>-->
						 			<b>Current Payment:</b> ' . $info['payment'] . '<br>
						 			<b>Months Remaining:</b> ' . $info['monthsRemaining'] . '<br>
						 			<b>Interested In:</b> ' . $info['nextVehicle'] . '<br>
						 		</td>
						 	</tr>
						 </table>
						</b>
						<br><br>						
			 			<b>' . $dealerInfo[$info['dealer']]['name'] . '</b><br>
			 			' . $dealerInfo[$info['dealer']]['address'] . '<br><br>
					 </font>
					';
}
			else {	
	 			$body .= '
					 	<table cellspacing="0" cellpadding="0">
						 	<tr>
						 		<td style="font-size:10pt;font-family:Arial;padding:10px 0px">
						 			
						 			<b>Name:</b> ' . $info['firstname'] . ' ' . $info['lastname'] . '<br>
						 			<b>Email:</b> ' . $info['email'] . '<br>
						 			<b>Mobile:</b> ' . $info['mobile'] . '<br>
						 			<b>Address:</b> ' . $info['address'] . ' ' . $info['postalCode'] . '<br>
						 			<b>Year:</b> ' . $info['years'] . '<br>
						 			<b>Make:</b> ' . $info['makes'] . '<br>
						 			<b>Model:</b> ' . $info['models'] . '<br>
						 			<b>Trim:</b> ' . $info['trims'] . '<br>
						 			<b>Style:</b> ' . $info['styles'] . '<br>
						 			<b>KM:</b> ' . $info['kilometers'] . '<br>
						 			<!-- <b>Trade in Value:</b> '. ($info['values']['tradeInLow'] != "" && $info['values']['tradeInLow'] != 0 ? '$' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']) : '') . '
						 			<br>-->
						 			<b>Current Payment:</b> ' . $info['payment'] . '<br>
						 			<b>Months Remaining:</b> ' . $info['monthsRemaining'] . '<br>
						 			<b>Interested In:</b> ' . $info['nextVehicle'] . '<br>
						 		</td>
						 	</tr>
						 </table>
						</b>
						<br><br>						
			 			<b>' . $dealerInfo[$info['dealer']]['name'] . '</b><br>
			 			' . $dealerInfo[$info['dealer']]['address'] . '<br><br>
					 </font>
					 <br><br>
					 <font style="font-size:9pt">* Your vehicle may have significant more value based on equipment/trim level. Value is subject to full inspection & appraisal.</font>
					';
}									
			$_SESSION['registerEmail']['info'] = $info;
				
// ATTACHMENT

				ob_start();
				include('rebateCertificateImage.php');
				$r_contents = ob_get_contents();
				ob_end_clean();

		if(in_array($info['dealer'],array('scottcampbell')))
			{
				$attachment = Swift_Attachment::newInstance($r_contents, "Down Payment Voucher.jpg", 'image/jpeg');  				
				$message->attach($attachment);	
			}								

			//NO VOUCHER ATTACHED  - BODY BOTTOM NOTE
		else if(in_array($info['dealer'],array('rainbow','oconnor','orleansdodge','camrose','leamington','bustard','lakehuron','bayview','islington','galt','ontario','atlantic','bayking','dewildt'))) 
			{
			}	

		else {			
			$attachment = Swift_Attachment::newInstance($r_contents, "Trade-Up Voucher.jpg", 'image/jpeg');  				
			$message->attach($attachment);
			}
			
			$message->setBody($body, 'text/html');
			$message->setTo(array(trim($info['email'])));

			//$message->setTo(array('dpaoa@hotmail.com','davepao@gmx.com'));
			//$message->setTo(array('dave@absoluteresults.com'));
			//$message->setBcc(array('dave@absoluteresults.com','jarnoldussen@bridgecitychrysler.com'));
			
			//$message->setBcc(array('dave@absoluteresults.com'));
			if($info['dealer'] == 'derrick') $message->setBcc(array('dave@absoluteresults.com','upgrade@derrickdodge.com','phall@derrickdodge.com','jpulyk@derrickdodge.com','rbunes@derrickdodge.com','wtaylor@derrickdodge.com'));
			else if($info['dealer'] == 'langley') $message->setBcc(array('mbrandner@langleychrysler.com','swilson@langleychrysler.com','brad@langleychrysler.com'));
			else $message->setBcc(array('dave@absoluteresults.com',$dealerInfo[$info['dealer']]['email1'],$dealerInfo[$info['dealer']]['email']));
				
			//$message->setBcc(array('dave@absoluteresults.com'));
			$message->setReturnPath('dave@absoluteresults.com');
			$message->setFrom($dealerInfo[$info['dealer']]['email1']);
			
			if($mailer->send($message))
			{
				echo 'true';
			}
			else
			{
				echo 'false';	
			}
			
		} 
		catch (Swift_TransportException $e) 
		{
				echo 'false';	
		} 
		catch (Swift_Message_MimeException $e) 
		{
				echo 'false';	
		}
    }
   
  ?>