public function process()
	{
		if (Yii::$app->db->getTableSchema($this->table) == null) {
			throw new \yii\base\InvalidConfigException('"' . $this->table . '" not found in database. Make sure the db migration is properly done and the table is created.');
		}
		
		$success = true;

		$items = Queue::find()->where(['and', ['sent_time' => NULL], ['<', 'attempts', $this->maxAttempts], ['<=', 'time_to_send', date('Y-m-d H:i:s')]])->orderBy(['created_at' => SORT_ASC])->limit($this->mailsPerRound);
		foreach ($items->each() as $item) {
		    if ($message = $item->toMessage()) {
			$attributes = ['attempts', 'last_attempt_time'];
			if ($this->send($message)) {
			    $item->sent_time = new \yii\db\Expression('NOW()');
			    $attributes[] = 'sent_time';
			} else {
			    $success = false;
			}

			$item->attempts++;
			$item->last_attempt_time = new \yii\db\Expression('NOW()');

			$item->updateAttributes($attributes);
		    }
		}
	
		// Purge messages now?
		if ($this->autoPurge) {
			$this->purge();
		}

		return $success;
	}
public function process()
	{
		if (Yii::$app->db->getTableSchema($this->table) == null) {
			throw new \yii\base\InvalidConfigException('"' . $this->table . '" not found in database. Make sure the db migration is properly done and the table is created.');
		}
		
		$success = true;

		$items = Queue::find()->where(['and', ['sent_time' => NULL], ['<', 'attempts', $this->maxAttempts], ['<=', 'time_to_send', date('Y-m-d H:i:s')]])->orderBy(['created_at' => SORT_ASC])->limit($this->mailsPerRound);
		foreach ($items->each() as $item) {
		    if ($message = $item->toMessage()) {
			$attributes = ['attempts', 'last_attempt_time'];
			if ($this->send($message)) {
			    $item->sent_time = new \yii\db\Expression('NOW()');
			    $attributes[] = 'sent_time';
			} else {
			    $success = false;
			}

			$item->attempts++;
			$item->last_attempt_time = new \yii\db\Expression('NOW()');

			$item->updateAttributes($attributes);
		    }
		}
	
		// Purge messages now?
		if ($this->autoPurge) {
			$this->purge();
		}

		return $success;
	}
public function process ( ) { if ( Yii :: $ app -> db -> getTableSchema ( $ this -> table ) == null ) { throw new \ yii \ base \ InvalidConfigException ( '"' . $ this -> table . '" not found in database. Make sure the db migration is properly done and the table is created.' ) ; } $ success = true ; $ items = Queue :: find ( ) -> where ( [ 'and' , [ 'sent_time' => NULL ] , [ '<' , 'attempts' , $ this -> maxAttempts ] , [ '<=' , 'time_to_send' , date ( 'Y-m-d H:i:s' ) ] ] ) -> orderBy ( [ 'created_at' => SORT_ASC ] ) -> limit ( $ this -> mailsPerRound ) ; foreach ( $ items -> each ( ) as $ item ) { if ( $ message = $ item -> toMessage ( ) ) { $ attributes = [ 'attempts' , 'last_attempt_time' ] ; if ( $ this -> send ( $ message ) ) { $ item -> sent_time = new \ yii \ db \ Expression ( 'NOW()' ) ; $ attributes [ ] = 'sent_time' ; } else { $ success = false ; } $ item -> attempts ++ ; $ item -> last_attempt_time = new \ yii \ db \ Expression ( 'NOW()' ) ; $ item -> updateAttributes ( $ attributes ) ; } } // Purge messages now? if ( $ this -> autoPurge ) { $ this -> purge ( ) ; } return $ success ; }
Sends out the messages in email queue and update the database.

@return boolean true if all messages are successfully sent out
Sends out the messages in email queue and update the database .