当前位置: 首页>>代码示例>>PHP>>正文


PHP Swift_SmtpTransport::setEncryption方法代码示例

本文整理汇总了PHP中Swift_SmtpTransport::setEncryption方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_SmtpTransport::setEncryption方法的具体用法?PHP Swift_SmtpTransport::setEncryption怎么用?PHP Swift_SmtpTransport::setEncryption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Swift_SmtpTransport的用法示例。


在下文中一共展示了Swift_SmtpTransport::setEncryption方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Mailer constructor.
  * @param $configuration
  */
 public function __construct($configuration)
 {
     $transport = new \Swift_SmtpTransport($configuration["host"], $configuration["port"]);
     $transport->setUsername($configuration["username"]);
     $transport->setPassword($configuration["password"]);
     $transport->setAuthMode($configuration["auth_mode"]);
     $transport->setEncryption($configuration["encryption"]);
     $this->mailer = new \Swift_Mailer($transport);
     $this->debugMail = isset($configuration["debug_email"]) ? $configuration["debug_email"] : null;
 }
开发者ID:nagyatka,项目名称:kodiapp,代码行数:14,代码来源:Mailer.php

示例2: __construct

 public function __construct(array $options = array())
 {
     $swiftTransort = new \Swift_SmtpTransport();
     $swiftTransort->setHost($options['smtp']);
     $swiftTransort->setPort($options['port']);
     if (isset($options['encryption'])) {
         $swiftTransort->setEncryption($options['encryption']);
     }
     if (isset($options['username'])) {
         $swiftTransort->setUsername($options['username']);
     }
     if (isset($options['password'])) {
         $swiftTransort->setPassword($options['password']);
     }
     if (isset($options['auth_mode'])) {
         $swiftTransort->setAuthMode($options['auth_mode']);
     }
     $this->_mailer = new \Swift_Mailer($swiftTransort);
 }
开发者ID:puuble,项目名称:pubmvc,代码行数:19,代码来源:AdapterSwiftMailer.php

示例3: createSmtpTransport

 private function createSmtpTransport(array $config = null)
 {
     $transport = new \Swift_SmtpTransport();
     if (!$config) {
         return $transport;
     }
     if (isset($config['host'])) {
         $transport->setHost($config['host']);
     }
     if (isset($config['port'])) {
         $transport->setPort($config['port']);
     }
     if (isset($config['encryption'])) {
         $transport->setEncryption($config['encryption']);
     }
     if (isset($config['username'])) {
         $transport->setUsername($config['username']);
     }
     if (isset($config['password'])) {
         $transport->setPassword($config['password']);
     }
     return $transport;
 }
开发者ID:phtamas,项目名称:yii2-mailer,代码行数:23,代码来源:Component.php

示例4: createMailer

 /**
  * @return \Swift_Mailer
  */
 protected function createMailer()
 {
     $transport = new \Swift_SmtpTransport($this->host);
     if ($this->port) {
         $transport->setPort($this->port);
     }
     if ($this->username) {
         $transport->setUsername($this->username);
     }
     if ($this->password) {
         $transport->setPassword($this->password);
     }
     if ($this->encryption) {
         $transport->setEncryption($this->encryption);
     }
     return \Swift_Mailer::newInstance($transport);
 }
开发者ID:avisota,项目名称:core,代码行数:20,代码来源:SmtpTransport.php

示例5: sendResetEmail

 protected function sendResetEmail($twig, $user_id, $email, $reset_code)
 {
     // Create our Mailer object
     $loader = new ConfigINIFileLoader(APP_DIR . '/config/config.' . APP_ENV . '.ini');
     $config_data = $loader->load();
     $transport = new \Swift_SmtpTransport($config_data['smtp']['host'], $config_data['smtp']['port']);
     if (!empty($config_data['smtp']['user'])) {
         $transport->setUsername($config_data['smtp']['user'])->setPassword($config_data['smtp']['password']);
     }
     if (!empty($config_data['smtp']['encryption'])) {
         $transport->setEncryption($config_data['smtp']['encryption']);
     }
     // Build our email that we will send
     $template = $twig->loadTemplate('emails/reset_password.twig');
     $parameters = array('reset_code' => $reset_code, 'method' => !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', 'host' => !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost', 'user_id' => $user_id, 'email' => $config_data['application']['email'], 'title' => $config_data['application']['title']);
     try {
         $mailer = new \Swift_Mailer($transport);
         $message = new \Swift_Message();
         $message->setTo($email);
         $message->setFrom($template->renderBlock('from', $parameters), $template->renderBlock('from_name', $parameters));
         $message->setSubject($template->renderBlock('subject', $parameters));
         $message->setBody($template->renderBlock('body_text', $parameters));
         $message->addPart($template->renderBlock('body_html', $parameters), 'text/html');
         return $mailer->send($message);
     } catch (\Exception $e) {
         echo $e;
         die;
     }
 }
开发者ID:themrwilliams,项目名称:opencfp,代码行数:29,代码来源:ForgotController.php

示例6: setEncryption

 public function setEncryption($encryption)
 {
     \Assert\that($encryption)->nullOr()->string()->choice(array('ssl', 'tls'));
     return parent::setEncryption($encryption);
 }
开发者ID:mykanoa,项目名称:kanoa,代码行数:5,代码来源:SmtpTransport.php

示例7: sprintf

    if ($subscriber = $repo->findOneBy(['unsubscribeToken' => $token])) {
        $em = $app['orm.em'];
        $em->remove($subscriber);
        $em->flush();
        $app['session']->getFlashBag()->add('message', sprintf('You successfully unsubscribed!'));
    }
    return $app->redirect('/');
});
$app['swift'] = function ($app) {
    $conf = $app['config'];
    $transport = new Swift_SmtpTransport();
    $transport->setHost($conf->get('smtp.host'));
    $transport->setPort($conf->get('smtp.port'));
    $transport->setUsername($conf->get('smtp.username'));
    $transport->setPassword($conf->get('smtp.password'));
    $transport->setEncryption($conf->get('smtp.security'));
    $mailer = new Swift_Mailer($transport);
    $mailer->registerPLugin(new CssInlinerPlugin());
    return $mailer;
};
$app['rfc.builder'] = function ($app) {
    return new RfcBuilder($app['config']->get('storagePath'));
};
$app['rfc.service'] = function ($app) {
    return new RfcService($app['rfc.builder'], $app['config']->get('rfcUrl'));
};
$app['diff.service'] = function ($app) {
    return new DiffService();
};
$app['slack.api'] = function ($app) {
    $interactor = new CurlInteractor();
开发者ID:shakyShane,项目名称:php-rfc-digestor,代码行数:31,代码来源:app.php

示例8: sendSubmitEmail

 /**
  * Method that sends an email when a talk is created
  *
  * @param Application $app
  * @param string $email
  * @param integer $talk_id
  * @return mixed
  */
 protected function sendSubmitEmail(Application $app, $email, $talk_id)
 {
     $mapper = $app['spot']->mapper('OpenCFP\\Entity\\Talk');
     $talk = $mapper->get($talk_id);
     // Create our Mailer object
     $loader = new ConfigINIFileLoader(APP_DIR . '/config/config.' . APP_ENV . '.ini');
     $config_data = $loader->load();
     $transport = new \Swift_SmtpTransport($config_data['smtp']['host'], $config_data['smtp']['port']);
     if (!empty($config_data['smtp']['user'])) {
         $transport->setUsername($config_data['smtp']['user'])->setPassword($config_data['smtp']['password']);
     }
     if (!empty($config_data['smtp']['encryption'])) {
         $transport->setEncryption($config_data['smtp']['encryption']);
     }
     // Build our email that we will send
     $template = $app['twig']->loadTemplate('emails/talk_submit.twig');
     $parameters = array('email' => $config_data['application']['email'], 'title' => $config_data['application']['title'], 'talk' => $talk->title, 'enddate' => $config_data['application']['enddate']);
     try {
         $mailer = new \Swift_Mailer($transport);
         $message = new \Swift_Message();
         $message->setTo($email);
         $message->setFrom($template->renderBlock('from', $parameters), $template->renderBlock('from_name', $parameters));
         $message->setSubject($template->renderBlock('subject', $parameters));
         $message->setBody($template->renderBlock('body_text', $parameters));
         $message->addPart($template->renderBlock('body_html', $parameters), 'text/html');
         return $mailer->send($message);
     } catch (\Exception $e) {
         echo $e;
         die;
     }
 }
开发者ID:themrwilliams,项目名称:opencfp,代码行数:39,代码来源:TalkController.php


注:本文中的Swift_SmtpTransport::setEncryption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。