예제 #1
0
/**
 * Process mail queue (cron task function).
 *
 * @param vivvo_lite_site	$sm
 */
function mail_queue($sm)
{
    require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/framework/PEAR/Mail/Queue.php';
    $container_options = array('type' => 'mdb2', 'dsn' => VIVVO_DB_TYPE . '://' . VIVVO_DB_USER . ':' . VIVVO_DB_PASSWORD . '@' . VIVVO_DB_HOST . '/' . VIVVO_DB_DATABASE, 'mail_table' => VIVVO_DB_PREFIX . 'mail_queue');
    if (VIVVO_EMAIL_SMTP_PHP == 1) {
        $mail_options = array('driver' => 'mail');
    } else {
        $mail_options = array('driver' => 'smtp', 'host' => VIVVO_EMAIL_SMTP_HOST, 'port' => VIVVO_EMAIL_SMTP_PORT, 'localhost' => 'localhost');
        if (VIVVO_EMAIL_SMTP_PASSWORD != '' and VIVVO_EMAIL_SMTP_USERNAME != '') {
            $mail_options['auth'] = true;
            $mail_options['username'] = VIVVO_EMAIL_SMTP_USERNAME;
            $mail_options['password'] = VIVVO_EMAIL_SMTP_PASSWORD;
        } else {
            $mail_options['auth'] = false;
            $mail_options['username'] = '';
            $mail_options['password'] = '';
        }
    }
    $mail_queue = new Mail_Queue($container_options, $mail_options);
    $mail_queue->sendMailsInQueue(VIVVO_PLUGIN_NEWSLETTER_NUMBER_OF_MAILS);
    if (defined('VIVVO_CRONJOB_MODE')) {
        echo 'mail_queue: Finished.' . PHP_EOL;
    }
}
예제 #2
0
파일: mailer.php 프로젝트: Blu2z/implsk
<?php

// Parameters (GET): number (default: 20)
$NETCAT_FOLDER = join(strstr(__FILE__, "/") ? "/" : "\\", array_slice(preg_split("/[\\/\\\\]+/", __FILE__), 0, -3)) . (strstr(__FILE__, "/") ? "/" : "\\");
include_once $NETCAT_FOLDER . "vars.inc.php";
require_once $ROOT_FOLDER . "connect_io.php";
require_once $INCLUDE_FOLDER . "lib/Mail/Queue.php";
$number = $_GET['number'] ? $_GET['number'] : 20;
$db_options = array('type' => 'ezsql', 'mail_table' => 'Mail_Queue');
$mail_options = array('driver' => 'mail');
$mail_queue = new Mail_Queue($db_options, $mail_options);
$mail_queue->sendMailsInQueue($number);
예제 #3
0
$mailsInQueue = c("select id from mail_queue where sent_time is null");
// IF NO EMAILS TO SEND IN QUEUE, RETURN
if (!$mailsInQueue) {
    if (CRON) {
        echo "Mails In Queue: " . $mailsInQueue . "\nNothing to Do.\n\n";
    }
    return;
} else {
    if (CRON) {
        echo "Mails In Queue: " . $mailsInQueue . "\nBatch Size: " . $mail_options['max_ammount_mails'] . "\nTrys: " . $mail_options['how_many_trys'] . "\nSending...\n\n";
    }
}
// MAILQUEUE INSTANCE
$mail_queue = new Mail_Queue($container_options, $mail_options);
// MAILQUEUE SEND ALL EMAILS IN QUEUE FROM THE BEGINING, IN CHUNKS OF X NUMBERS OF MAILS, TRYING X TIMES
$result = $mail_queue->sendMailsInQueue($mail_options['max_ammount_mails'], MAILQUEUE_START, $mail_options['how_many_trys'], 'mailqueue_callback');
if (!CRON && $result == true) {
    header("Location: ../index.php");
} else {
    echo "MAILQUEUE_ERROR object:";
    pr($result);
    die;
    //return false;
}
// FUNCTION CALLBACK TO UPDATE LOG FIELD IN DB.
function mailqueue_callback($args)
{
    if (!$args) {
        echo "NOT ARGS IN CALLBACK:";
        pr($args);
        die;
<?php

/**
 * @copyright 2005-2008 OpenPNE Project
 * @license   http://www.php.net/license/3_01.txt PHP License 3.01
 */
require_once './config.inc.php';
require_once OPENPNE_WEBAPP_DIR . '/init.inc';
if (OPENPNE_UNDER_MAINTENANCE) {
    exit;
}
require_once 'Mail/Queue.php';
$db_opt = array("type" => "db", "dsn" => $GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn'], "mail_table" => "mail_queue");
$mail_opt = array("driver" => "mail");
$mail_queue = new Mail_Queue($db_opt, $mail_opt);
$mail_queue->sendMailsInQueue(SEND_MAIL_QUEUE_NUM);