Create an instance of the Mailgun Swift Transport driver.

@return \Illuminate\Mail\Transport\MailgunTransport
354156
protected function createMailgunDriver()
    {
        $config = $this->app['config']->get('services.mailgun', []);

        return new MailgunTransport(
            $this->guzzle($config),
            $config['secret'],
            $config['domain'],
            $config['endpoint'] ?? null
        );
    }
729526
protected function createSparkPostDriver()
    {
        $config = $this->app['config']->get('services.sparkpost', []);

        return new SparkPostTransport(
            $this->guzzle($config), $config['secret'], $config['options'] ?? []
        );
    }
868567
protected function getMailer()
    {
        $transport = null;
        if ($this->configurationManager->getSetting('mailer.type') === 'sendmail') {
            $transport = \Swift_SendmailTransport::newInstance($this->configurationManager->getSetting('mailer.sendmailCommand'));
        } else if ($this->configurationManager->getSetting('mailer.type') === 'smtp') {
            $host = $this->configurationManager->getSetting('mailer.smtpHost');
            $port = $this->configurationManager->getSetting('mailer.smtpPort');
            $username = $this->configurationManager->getSetting('mailer.smtpUsername');
            $password = $this->configurationManager->getSetting('mailer.smtpPassword');
            
            $transport = \Swift_SmtpTransport::newInstance($host, $port);
            $transport->setUsername($username);
            $transport->setPassword($password);
        }
        
        if ($transport === null) {
            throw new Exception('No mail transport defined. Please check your configuration.');
        }

        return \Swift_Mailer::newInstance($transport);
    }
246410
protected function registerSwiftTransport()
    {
        if ($this->app->isRunningOnGae()) {
            $this->app['swift.transport'] = $this->app->share(function ($app) {
                return new GaeTransportManager($app);
            });
        } else {
            parent::registerSwiftTransport();
        }
    }
972987
public function getTransport()
    {
        $config = $this->config;
        $transport = \Swift_SmtpTransport::newInstance($config['mail']['hostname'], $config['mail']['port']);
        $transport->setUsername($config['mail']['username']);
        $transport->setPassword($this->getPassword());
        if(isset($config['mail']['encryption'])) {
            $transport->setEncryption($config['mail']['encryption']);
        }
        return $transport;
    }
942990
protected function _getTransport()
    {
        if ($this->_mailer === 'smtp') {
            $transport = Swift_SmtpTransport::newInstance($this->_site_settings->smtphost, $this->_site_settings->smtpport)
            ->setUsername($this->_site_settings->smtpuser)
            ->setPassword($this->_site_settings->smtppass);
        } elseif ($this->_mailer === 'sendmail') {
            $transport = Swift_SendmailTransport::newInstance('/usr/sbin/exim -bs');
        } else {
            $transport = Swift_MailTransport::newInstance();
        }

        return $transport;
    }
1038493
public static function instance($transport = null)
    {
        if (null === self::$instance) {
            self::$instance = new static($transport);
        }

        return self::$instance;
    }
1121016
public function getMailInstance($config = null)
    {
        if (!$config) {
            $config = $this->config('config');
        }

        $sender = Configure::read('CM.Mail.sender');

        $object = $this->EmailObject;

        $object->sender($sender['email'], $sender['name']);

        if (Configure::read('CM.Mail.transport')) {
            $object->transport(Configure::read('CM.Mail.transport'));
        }

        return $object;
    }
283617
public function send()
    {
        $settings = Application::getSettings()->mail;
        $mailTransport = new Transport(
            @$settings->smtp->host ? : 'localhost',
            @$settings->smtp->port ? : 25,
            @$settings->smtp->timeout ? : 15
        );

        $mailTransport->setUser(
            @$settings->smtp->user,
            @$settings->smtp->password
        );

        $mailTransport->addMessage($this);

        $mailTransport->send();
    }
674405
public function build(): DeliverPushMessageRequest
	{
		$instance = new DeliverPushMessageRequest();
		if ($this->origin === null) {
			throw new BuilderException('Property [origin] is required.');
		}
		$instance->origin = $this->origin;
		if ($this->registrationId === null) {
			throw new BuilderException('Property [registrationId] is required.');
		}
		$instance->registrationId = $this->registrationId;
		if ($this->data === null) {
			throw new BuilderException('Property [data] is required.');
		}
		$instance->data = $this->data;
		return $instance;
	}
763274
public function createSendmailDriver($sendmail = null)
    {
        $transport = Swift_SendmailTransport::newInstance(
            $sendmail ? $sendmail : Config::get('sendmail')
        );

        return $transport;
    }
24424
protected function createSparkPostDriver()
	{
		$config = Config::get( 'services.sparkpost', [] );

		return new SparkPostTransport( $this->getHttpClient( $config ), $config['secret'], Arr::get( $config, 'options', [] ) );
	}
973839
public function create()
    {
        foreach ($this->driverClasses as $driverClass) {
            try {
                $driver = new $driverClass();

                return $driver;
            } catch (\Exception $e) {
            }
        }

        return null;
    }
959305
protected function createNativeDriver()
    {
        $lifetime = $this->app['config']['session.lifetime'];

        return $this->buildSession(new FileSessionHandler(
            $this->app['files'], $this->app['config']['session.files'], $lifetime
        ));
    }
1000065
private function transport()
    {
        $this->transport = Transport::newInstance($this->smtp->get('host'), $this->smtp->get('port'), $this->smtp->get('encryption'))
            ->setUsername($this->smtp->get('username'))
            ->setPassword($this->smtp->get('password'));

        return $this->transport;
    }
1363844
protected function createTransport(array $config)
    {
        if (!isset($config['class'])) {
            $config['class'] = 'Swift_SendmailTransport';
        }
        if (isset($config['plugins'])) {
            $plugins = $config['plugins'];
            unset($config['plugins']);
        } else {
            $plugins = [];
        }

        if ($this->enableSwiftMailerLogging) {
            $plugins[] = [
                'class' => 'Swift_Plugins_LoggerPlugin',
                'constructArgs' => [
                    [
                        'class' => 'yii\swiftmailer\Logger'
                    ]
                ],
            ];
        }

        /* @var $transport \Swift_Transport */
        $transport = $this->createSwiftObject($config);
        if (!empty($plugins)) {
            foreach ($plugins as $plugin) {
                if (is_array($plugin) && isset($plugin['class'])) {
                    $plugin = $this->createSwiftObject($plugin);
                }
                $transport->registerPlugin($plugin);
            }
        }

        return $transport;
    }
569064
public static function create()
    {
        $builder = NotifireBuilder::create();

        if (\class_exists('Swift_Mailer')) {
            $transport = new \Swift_SmtpTransport('localhost', 25);
            $mailer = new \Swift_Mailer($transport);

            $handler = new SwiftMailerHandler($mailer, 'default');
            if (\class_exists('Twig_Environment')) {
                $env = new \Twig_Environment(new \Twig_Loader_Filesystem());
                $handler->setTwig($env);
            }

            $builder->addHandler($handler);
            $builder->addNotification('email', Email::class);
        }

        $builder->initialize();
    }