<?php
session_start();
if(isset($_GET['regID']))
{
$info = unserialize(stripslashes(urldecode($_GET['regID'])));
$info['dealer'] = $info['selectedDealer'];
include_once('includes.php');
if($dealerInfo[$info['dealer']]['eventID'] != "")
{
$_GET['promo'] = 'Trade My Keys Event';
$_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('mx2.newgencloud.com');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($dealerInfo[$info['dealer']]['name'] . " Confirmation - La Combinaison Parfaite");
// Gift Value
$eventDate = $dealerInfo[$info['dealer']]['eventDate'];
$gift = $dealerInfo[$info['dealer']]['gift'];
switch ($gift)
{
case "no":
case "NO":
case "none":
case "NONE":
//$perks = "";
$perks = '<br /><br /><b><font style="color:blue;font-size:11pt">Faites un essai routier durant la vente du ' . $eventDate . ' et épargnez gros à l\'achat d\'un véhicule neuf!</font></b>';
break;
default:
$perks = '<br /><br /><b><font style="color:blue;font-size:11pt">EXTRA BONI: Faites un essai routier durant la vente du ' . $eventDate . ' et recevez ' . $gift .'!</font></b>';
break;
}
// Extra Bonus
$extraBonus = $dealerInfo[$info['dealer']]['bonus'];
switch ($extraBonus)
{
case "no":
case "NO":
case "none":
case "NONE":
$extra = "";
break;
case "TV":
$extra = '<br /><br /><font style="color:blue;font-size:11pt;font-weight:bold;">EVERY REGISTER CUSTOMER RECEIVES A CHANCE TO WIN CANUCKS TICKETS AND A 50" TV !!</font>';
break;
case "tablet":
$extra = '<br /><br /><b><font style="color:blue;font-size:11pt">BUY A NEW VEHICLE AND RECEIVE A </b> <span style="color:red">FREE SAMSUNG TABLET</span>!!!</font></b>';
break;
case "spin":
$extra = '<br /><br /><b><font style="color:blue;font-size:11pt">BUY A NEW VEHICLE AND </b> <span style="color:red">Spin For A Free Gas Card for up to $1000 in value</span>!!!</font></b>';
break;
default:
// $extra = '<b>JUST ANNOUNCED:</b> <span style="color:red">$500 HOLIDAY CASH BONUS</span> on qualifing new vehicles!!';
$extra = '<br /><br /><b><font style="color:blue;font-size:11pt">JUST ANNOUNCED:</b> <span style="color:red">'. $extraBonus .'</span> on qualifing new vehicles!!</font></b>';
break;
}
if($info['values']['tradeInLow'] != "" && $info['values']['tradeInLow'] != 0)
{
// Black Book Value
$blackbook = $dealerInfo[$info['dealer']]['blackbook'];
$bbooke = '<br><br><b>
<font style="font-size:11pt">
Selon le Canadian Black Book,
</font>
<br>
<font style="font-size:13pt">
Votre ' . ucwords($info['years'] . ' ' . $info['makes'] . ' ' . $info['models']) . ' est évalué à <u>$' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']) . '</u>
</font>
</b>';
switch ($blackbook)
{
case "no":
case "NO":
case "none":
case "NONE":
$bbook = "";
break;
default:
$bbook = $bbooke;
}
}
// NO VOUCHER (see below for attachement at bottom of email)
$voucher = $dealerInfo[$info['dealer']]['voucher'];
$vouche = '<br><br>Votre coupon rabais est joint à ce message.<br>Veuillez l\'imprimer et l\'apporter avec vous chez le concessionnaire.';
switch ($voucher)
{
case "no":
case "NO":
case "none":
case "NONE":
$vouch = "";
break;
default:
$vouch = $vouche;
break;
}
// BODY OF MESSAGE STARTS HERE
$blackbook2 = $dealerInfo[$info['dealer']]['blackbook'];
switch ($blackbook2)
{
case "no":
case "NO":
case "none":
case "NONE":
$body = '
<font style="font-size:10pt;font-family:Arial">
Cher-ère ' . $info['firstname'] . ',
<br><br>
Merci pour votre inscription!'
//Voucher Value * Gift Value * Bonus Value
. $vouch . $perks . $extra .
'<br><br>
<b>' . $dealerInfo[$info['dealer']]['name'] . '</b><br>
' . $dealerInfo[$info['dealer']]['address'] . '<br><br>
</font>';
break;
default:
$body = '
<font style="font-size:10pt;font-family:Arial">
Cher-ère ' . $info['firstname'] . ',
<br><br>
Merci pour votre inscription!'
//Black Book Value * Voucher Value * Gift Value * Bonus Value
. $bbook . $vouch . $perks . $extra .
'<br><br>
<table cellspacing="0" cellpadding="0">
<tr>
<td style="font-size:10pt;font-family:Arial;padding:10px 0px">
<b>Nom:</b> ' . $info['firstname'] . ' ' . $info['lastname'] . '<br>
<b>Courrier:</b> ' . $info['email'] . '<br>
<b>Cellulaire:</b> ' . $info['mobile'] . '<br>
<b>Adresse:</b> ' . $info['address'] . ' ' . $info['postalCode'] . '<br>
<b>Année:</b> ' . $info['years'] . '<br>
<b>Marque:</b> ' . $info['makes'] . '<br>
<b>Modèle:</b> ' . $info['models'] . '<br>
<b>Coupe:</b> ' . $info['trims'] . '<br>
<b>Carosserie:</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>Paiement mensuel:</b> ' . $info['payment'] . '<br>
<b>Solde à payer:</b> ' . $info['monthsRemaining'] . '<br>
<b>Véhicule convoité:</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">* La valeur de votre véhicule peut varier en fonction des accessoires et équiments ajoutés. L\'estimation de la valeur de votre véhicule est sujette à une inspection et évaluation du véhicule.</font>';
}
//}
// END: BODY OF MESSAGE
$_SESSION['registerEmail']['info'] = $info;
//VOUCHER ATTACHED - Naming the attachment
// NO VOUCHER (see below for attachement at bottom of email)
$voucherjpg = $dealerInfo[$info['dealer']]['voucher'];
switch ($voucherjpg)
{
case "no":
case "NO":
case "none":
case "NONE":
echo '';
break;
default:
ob_start();
include('rebateCertificateImage.php');
$r_contents = ob_get_contents();
ob_end_clean();
$attachment = Swift_Attachment::newInstance($r_contents, "Coupon.jpg", 'image/jpeg');
$message->attach($attachment);
break;
}
$message->setBody($body, 'text/html');
$message->setTo(array(trim($info['email'])));
//see dealerEvent.php
$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';
}
}
?>