Swift_Transport::start PHP Method

start() public method

Start this Transport mechanism.
public start ( )
    public function start();

Usage Example

Exemplo n.º 1
0
 /**
  * Sends messages using the given transport instance.
  *
  * @param Swift_Transport $transport         A transport instance
  * @param string[]        &$failedRecipients An array of failures by-reference
  *
  * @return int The number of sent emails
  */
 public function flushQueue(Swift_Transport $transport, &$failedRecipients = null)
 {
     if (!$transport->isStarted()) {
         $transport->start();
     }
     $failedRecipients = (array) $failedRecipients;
     $count = 0;
     $time = time();
     foreach (new DirectoryIterator($this->_path) as $file) {
         $file = $file->getRealPath();
         if (!strpos($file, '.message')) {
             continue;
         }
         $message = unserialize(file_get_contents($file));
         $count += $transport->send($message, $failedRecipients);
         unlink($file);
         if ($this->getMessageLimit() && $count >= $this->getMessageLimit()) {
             break;
         }
         if ($this->getTimeLimit() && time() - $time >= $this->getTimeLimit()) {
             break;
         }
     }
     return $count;
 }
All Usage Examples Of Swift_Transport::start