コード例 #1
0
        $result = $bouncehandler->get_the_facts($raw_message);
        $result = $result[0];
        $status = $result['status'];
        $action = $result['action'];
        $recipient = trim($result['recipient']);
        if (!in_array($action, array("delayed", "failed", "autoreply"))) {
            $cli->output("Message index: {$index}, unknown action: {$action}, skipping...");
            continue;
        }
        if ($action == 'delayed' || $action == 'autoreply') {
            $cli->output("Deleting message: {$index}, action: {$action}");
            $pop3->delete($index);
            continue;
        }
        if ($action == 'failed') {
            $cli->output("Message index: {$index}, status: {$status}, action: {$action}, recipient: {$recipient}");
            $subscriptions = jajNewsletterSubscription::fetchActiveByEmail($recipient);
            foreach ($subscriptions as $subscription) {
                $state = $subscription->attribute("state");
                if ($state == "active") {
                    $cli->output("Found matching subscription: " . $subscription->attribute("uuid") . " changing status from: " . $subscription->attribute("state") . " to: bounced");
                    $subscription->setAttribute('state', 'bounced');
                    $subscription->setAttribute('bounced', time());
                    $subscription->setAttribute('modified', time());
                    $subscription->store();
                }
            }
            $pop3->delete($index);
        }
    } while ($set->nextMail());
}
コード例 #2
0
<?php

$Module = $Params['Module'];
$tpl = eZTemplate::factory();
$template = 'design:jaj_newsletter/subscription/unsubscribe.tpl';
$uuid = $Params['UUID'];
$subscription = jajNewsletterSubscription::fetchByUUID($uuid);
if (!is_object($subscription)) {
    return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
if ($Module->isCurrentAction('ConfirmUnsubscribe')) {
    if ($subscription->attribute("state") == "active") {
        $result = jajNewsletterSubscription::unsubscribeByUUID($subscription->attribute("uuid"));
    }
}
$subscriptions = jajNewsletterSubscription::fetchActiveByEmail($subscription->attribute('email'));
$tpl->setVariable('subscription', $subscription);
$tpl->setVariable('subscriptions', $subscriptions);
$Result = array('path' => array(array('url' => false, 'text' => ezpI18n::tr('jaj_newsletter/navigation', 'Newsletter')), array('url' => false, 'text' => ezpI18n::tr('jaj_newsletter/navigation', 'Unsubscribe'))), 'content' => $tpl->fetch($template));