public function testGetSmtpServer() { $expected = '*****@*****.**'; $this->mailOptions->setFrom($expected); $this->assertEquals($expected, $this->mailOptions->getSmtpUser()); $this->mailOptions->setSmtpUser('user'); $this->assertNotEquals($expected, $this->mailOptions->getSmtpUser()); }
/** * 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()))); } }