public function testDefaultMailOptionsValues() { $this->assertInstanceOf('\\Zend\\Mail\\Transport\\Sendmail', $this->mailOptions->getMailAdapter()); $this->assertNull($this->mailOptions->getMailAdapterService()); $this->assertEquals('localhost', $this->mailOptions->getServer()); $this->assertEquals('', $this->mailOptions->getFrom()); $this->assertEquals('', $this->mailOptions->getFromName()); $this->assertEquals(array(), $this->mailOptions->getTo()); $this->assertCount(0, $this->mailOptions->getTo()); $this->assertEquals(array(), $this->mailOptions->getCc()); $this->assertCount(0, $this->mailOptions->getCc()); $this->assertEquals(array(), $this->mailOptions->getBcc()); $this->assertCount(0, $this->mailOptions->getBcc()); $this->assertEquals('', $this->mailOptions->getSmtpUser()); $this->assertEquals('', $this->mailOptions->getSmtpPassword()); $this->assertFalse($this->mailOptions->getSsl()); $this->assertEquals('login', $this->mailOptions->getConnectionClass()); $this->assertEquals('', $this->mailOptions->getSubject()); $this->assertEquals('', $this->mailOptions->getBody()); $this->assertEquals(MailServiceInterface::DEFAULT_CHARSET, $this->mailOptions->getBodyCharset()); $this->assertEquals(25, $this->mailOptions->getPort()); $this->assertInstanceOf('AcMailer\\Options\\AttachmentsOptions', $this->mailOptions->getAttachments()); $this->assertInstanceOf('AcMailer\\Options\\TemplateOptions', $this->mailOptions->getTemplate()); $this->assertEquals('data/mail/output', $this->mailOptions->getFilePath()); $this->assertNull($this->mailOptions->getFileCallback()); }
/** * 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()))); } }