Magento – test abandoned cart email

A test script to test abandoned cart email

//test email abandonned cart
$storeId = 13;
$store = Mage::getSingleton('core/store')->load($storeId);
$quote = Mage::getModel('sales/quote')->setStore($store)->load(347453);
$email = "test@adin.pro";
// send email
$senderid = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SENDER, $storeId);
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderid/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderid/email", $storeId));



$name = $quote->getCustomerFirstname() . ' ' . $quote->getCustomerLastname();
$unsubscribeUrl = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=abandonedcart&email=' . $email . '&store=' . $storeId;
$couponcode = '';

// if days have passed proceed to send mail
if (true) {
    $mailsubject = "Abandonned cart relance";
    $templateId = 63;

    //$templateId = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::EMAIL_TEMPLATE_XML_PATH);
    $vars = array('quote' => $quote, 'url' => $url, 'unsubscribeurl' => $unsubscribeUrl, 'tags' => array("mandrilltag"));


    $customer = Mage::getModel('customer/customer')
        ->setStore(Mage::app()->getStore($storeId))
        ->loadByEmail($email);
    if ($customer->getId() && Mage::helper('sweetmonkey')->enabled()) {
        $tbtPoints = Mage::helper('ebizmarts_abandonedcart')->getTBTPoints($customer->getId());
        foreach ($tbtPoints as $key => $field) {
            if ($key == 'points') {
                if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
                    $vars[$key] = $field;
                }
            } else {
                $vars[$key] = $field;
            }
        }
    }

    Mage::app()->getTranslator()->init('frontend', true);
    $translate = Mage::getSingleton('core/translate');
    $mail = Mage::getModel('core/email_template')
        ->setTemplateSubject($mailsubject)
        ->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
    echo "==> tpl". $templateId." email: ".$email." name: ".$name." store: ".$storeId;
    $translate->setTranslateInLine(true);

    die('does it send ?');