Esempio n. 1
0
 /**
  * Reset Swift Mailer SMTP transport adapter
  *
  * @return void
  */
 protected function resetSwiftTransport()
 {
     if ($this->mailer && method_exists($this->mailer, 'isPretending') && $this->mailer->isPretending()) {
         return;
     }
     if (!($transport = $this->getSwiftMailerTransport())) {
         return;
     }
     if (!is_a($transport, '\\Swift_Transport_AbstractSmtpTransport')) {
         return;
     }
     if (!$transport->isStarted()) {
         $transport->start();
         return;
     }
     try {
         // Send RESET to restart the SMTP status and check if it's ready for running
         $transport->reset();
     } catch (Exception $e) {
         // In case of failure - let's try to stop it
         try {
             $transport->stop();
         } catch (Exception $e) {
             // Just start it then...
         }
         $transport->start();
     }
 }
Esempio n. 2
0
 /**
  * Check if the mailer is pretending to send messages.
  *
  * @return bool 
  * @static 
  */
 public static function isPretending()
 {
     return \Illuminate\Mail\Mailer::isPretending();
 }