コード例 #1
0
 /**
  * Configures specific transport options
  * @param TransportInterface $transport
  * @param MailOptions $mailOptions
  */
 protected function setupSpecificConfig(TransportInterface $transport, MailOptions $mailOptions)
 {
     if ($transport instanceof Smtp) {
         $connConfig = array('username' => $mailOptions->getSmtpUser(), 'password' => $mailOptions->getSmtpPassword());
         // Check if SSL should be used
         if ($mailOptions->getSsl() !== false) {
             $connConfig['ssl'] = $mailOptions->getSsl();
         }
         // Set SMTP transport options
         $transport->setOptions(new SmtpOptions(array('host' => $mailOptions->getServer(), 'port' => $mailOptions->getPort(), 'connection_class' => $mailOptions->getConnectionClass(), 'connection_config' => $connConfig)));
     } elseif ($transport instanceof File) {
         $transport->setOptions(new FileOptions(array('path' => $mailOptions->getFilePath(), 'callback' => $mailOptions->getFileCallback())));
     }
 }
コード例 #2
0
 public function testConnectionClass()
 {
     $expected = 'smtp';
     $this->assertSame($this->mailOptions, $this->mailOptions->setConnectionClass($expected));
     $this->assertEquals($expected, $this->mailOptions->getConnectionClass());
 }