public function actionRun($limit = 0)
    {
        $version = $this->module->version;
        $this->stdout("\nPodium mail queue v{$version}\n");
        $this->stdout("------------------------------\n");

        $emails = $this->getNewBatch($limit);
        if (empty($emails)) {
            $this->stdout("No pending emails in the queue found.\n\n", Console::FG_GREEN);
            return self::EXIT_CODE_NORMAL;
        }

        $total = count($emails);
        $this->stdout(
            "\n$total pending "
                . ($total === 1 ? 'email' : 'emails')
                . " to be sent now:\n",
            Console::FG_YELLOW
        );

        $errors = false;
        foreach ($emails as $email) {
            if (!$this->process(
                    $email,
                    $this->module->podiumConfig->get('from_name'),
                    $this->module->podiumConfig->get('from_email'),
                    $this->module->podiumConfig->get('max_attempts')
                )) {
                $errors = true;
            }
        }

        if ($errors) {
            $this->stdout("\nBatch sent with errors.\n\n", Console::FG_RED);
        } else {
            $this->stdout("\nBatch sent successfully.\n\n", Console::FG_GREEN);
        }
        return self::EXIT_CODE_NORMAL;
    }
public function actionRun($limit = 0)
    {
        $version = $this->module->version;
        $this->stdout("\nPodium mail queue v{$version}\n");
        $this->stdout("------------------------------\n");

        $emails = $this->getNewBatch($limit);
        if (empty($emails)) {
            $this->stdout("No pending emails in the queue found.\n\n", Console::FG_GREEN);
            return self::EXIT_CODE_NORMAL;
        }

        $total = count($emails);
        $this->stdout(
            "\n$total pending "
                . ($total === 1 ? 'email' : 'emails')
                . " to be sent now:\n",
            Console::FG_YELLOW
        );

        $errors = false;
        foreach ($emails as $email) {
            if (!$this->process(
                    $email,
                    $this->module->podiumConfig->get('from_name'),
                    $this->module->podiumConfig->get('from_email'),
                    $this->module->podiumConfig->get('max_attempts')
                )) {
                $errors = true;
            }
        }

        if ($errors) {
            $this->stdout("\nBatch sent with errors.\n\n", Console::FG_RED);
        } else {
            $this->stdout("\nBatch sent successfully.\n\n", Console::FG_GREEN);
        }
        return self::EXIT_CODE_NORMAL;
    }
public function actionRun ( $ limit = 0 ) { $ version = $ this -> module -> version ; $ this -> stdout ( "\nPodium mail queue v{$version}\n" ) ; $ this -> stdout ( "------------------------------\n" ) ; $ emails = $ this -> getNewBatch ( $ limit ) ; if ( empty ( $ emails ) ) { $ this -> stdout ( "No pending emails in the queue found.\n\n" , Console :: FG_GREEN ) ; return self :: EXIT_CODE_NORMAL ; } $ total = count ( $ emails ) ; $ this -> stdout ( "\n$total pending " . ( $ total === 1 ? 'email' : 'emails' ) . " to be sent now:\n" , Console :: FG_YELLOW ) ; $ errors = false ; foreach ( $ emails as $ email ) { if ( ! $ this -> process ( $ email , $ this -> module -> podiumConfig -> get ( 'from_name' ) , $ this -> module -> podiumConfig -> get ( 'from_email' ) , $ this -> module -> podiumConfig -> get ( 'max_attempts' ) ) ) { $ errors = true ; } } if ( $ errors ) { $ this -> stdout ( "\nBatch sent with errors.\n\n" , Console :: FG_RED ) ; } else { $ this -> stdout ( "\nBatch sent successfully.\n\n" , Console :: FG_GREEN ) ; } return self :: EXIT_CODE_NORMAL ; }
Runs the queue.
@param int $limit
@return int|void
Runs the queue .