<?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['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'] . " Trade Up 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)
{
$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>
';
}
if(in_array($info['dealer'],array('stonyplain','downsview')))
{
$body .= '
<br><br>
Your Trade-Up Voucher is attached to this email.<br>Please print and bring with you to the dealership.
<br><br>';
}
else if(in_array($info['dealer'],array('northbay')))
{
$body .= '
<br><br>
Your Supplier Pricing Certificate is attached to this email.<br>Please print and bring with you to the dealership.
<br><br>';
}
else if(in_array($info['dealer'],array('dixie','brampton')))
{
$body .= '
<br><br>
Your Savings Certificate is attached to this email.<br>Please print and bring with you to the dealership.
<br><br>';
}
else
{
$body .= '
<br><br>
Your Trade-Up Voucher & Supplier Pricing Certificate are attached to this email.<br>Please print and bring with you to the dealership.
<br><br>';
}
if($info['dealer'] == 'nelson')
{
$body .= '
<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and be entered into a draw to win A TRIP TO VEGAS!</font></b>
<br><br>
';
}
else if($info['dealer'] == '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($info['dealer'] == 'village')
{
$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($info['dealer'] == 'western')
{
$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!</font></b>
<br><br>
';
}
else if($info['dealer'] == 'willowbrook')
{
$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 $15 Tim Horton\'s Gift Card!</font></b>
<br><br>
';
}
else if($info['dealer'] == 'hunt')
{
$body .= '
<b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $dealerInfo[$info['dealer']]['eventDate'] . ' and be entered to win a 32" TV & Gift Cards!</font></b>
<br><br>
';
}
else if($info['dealer'] == 'raceway')
{
$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 $20 Tim Horton\'s Gift Card!</font></b>
<br><br>
';
}
else if(in_array($info['dealer'],array('okanagan','amherst','pioneer','rainbow','galt')))
{
$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('abbotsford','langley','kawarthachrysler','comoxvalley','vernon','brampton','unique')))
{
$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 Tim Horton\'s Gift Card!</font></b>
<br><br>
';
}
else if(in_array($info['dealer'],array('cranbrook','reliable','southside','carter','stpaul','downsview','stonyplain','eichenberg')))
{
$body .= '';
}
else if($info['dealer'] == 'derrick')
{
$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 Derrick Dodge Oil Change!</font></b>
<br><br>
';
}
else if($info['dealer'] == 'northbay')
{
$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 $50 Maintenance Card!</font></b>
<br><br>
';
}
else if($info['dealer'] == 'devon')
{
$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 $50 Gift Card!</font></b>
<br><br>
';
}
else
{
$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 Tim Horton\'s Gift Card!</font></b>
<br><br>
';
}
$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;
if(!in_array($info['dealer'],array('northbay')))
{
ob_start();
include('rebateCertificateImage.php');
$r_contents = ob_get_contents();
ob_end_clean();
$attachment = Swift_Attachment::newInstance($r_contents, "Trade-Up Voucher.jpg", 'image/jpeg');
$message->attach($attachment);
}
if(!in_array($info['dealer'],array('stonyplain','downsview','dixie','brampton')))
{
ob_start();
include('bestDealImage.php');
$s_contents = ob_get_contents();
ob_end_clean();
$attachment = Swift_Attachment::newInstance($s_contents, "Supplier Pricing Certificate.jpg", 'image/jpeg');
$message->attach($attachment);
}
if($info['dealer'] == 'okanagan')
{
ob_start();
include('serviceImage.php');
$s_contents = ob_get_contents();
ob_end_clean();
$attachment = Swift_Attachment::newInstance($s_contents, "Mopar Oil Change Coupon.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'] == 'islington') $message->setBcc(array('dave@absoluteresults.com','krams@islingtonchrysler.ca','kgraca@islingtonchrysler.ca','cmcisaac@islingtonchrysler.ca','prams@islingtonchrysler.ca'));
else if($info['dealer'] == 'village') $message->setBcc(array('dave@absoluteresults.com','jack@absoluteresults.com',$dealerInfo[$info['dealer']]['email1'],$dealerInfo[$info['dealer']]['email']));
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';
}
}
?>