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


PHP Swift_SmtpTransport::setPassword方法代码示例

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


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

示例1: connect

 /**
  * Connect to Mail server
  *
  * @param array $config
  * @return boolean
  */
 public function connect(array $config)
 {
     // Create the Transport
     $this->mailer = new \Swift_SmtpTransport($config['server'], $config['port'], sizeof($config['secure']) > 0 ? $config['secure'] : null);
     $this->mailer->setUsername($config['username']);
     $this->mailer->setPassword($config['password']);
     $this->mailer->start();
     return $this->mailer->isStarted();
 }
开发者ID:stanislav-web,项目名称:express-mailer,代码行数:15,代码来源:LocalDomain.php

示例2: testReport

 public function testReport()
 {
     //  Arrange.
     $transport = new \Swift_SmtpTransport();
     $transport->setHost('mailtrap.io');
     $transport->setPort(2525);
     $transport->setUsername(getenv('MAILTRAP_USERNAME'));
     $transport->setPassword(getenv('MAILTRAP_PASSWORD'));
     $mailer = new Swift_Mailer($transport);
     $message = new Swift_Message();
     $message->addTo('craig.michael.morris@gmail.com');
     $message->setFrom('craig.michael.morris@gmail.com');
     $body = new Body(new VarCloner(), new CliDumper());
     $compiler = new Compiler(new CommonMarkConverter(), new CssToInlineStyles());
     $email = new Email($mailer, $message, $body, $compiler);
     $exception = new DomainException('Testing a domain exception');
     $extra = ['only' => 'testing12321'];
     // Act.
     $email->report($exception, $extra);
     // Assert.
     $message = $this->mailtrap->get('inboxes/' . getenv('MAILTRAP_INBOX') . '/messages')->json()[0];
     $this->assertSame('Exception: Testing a domain exception', $message['subject']);
     $this->assertContains('$email->report($exception, $extra);', $message['text_body']);
     $this->assertContains("exception 'DomainException' with message 'Testing a domain exception'", $message['text_body']);
     $this->assertContains('{main}', $message['text_body']);
     $this->assertContains('"only" => "testing12321"', $message['text_body']);
     $this->assertContains('_SERVER', $message['text_body']);
 }
开发者ID:morrislaptop,项目名称:error-tracker-adapter-email,代码行数:28,代码来源:EmailTest.php

示例3: send

 public function send()
 {
     $smtpTransport = new \Swift_SmtpTransport($this->spoolMailerParam('host'), $this->spoolMailerParam('port'));
     $smtpTransport->setUsername($this->spoolMailerParam('username'));
     $smtpTransport->setPassword($this->spoolMailerParam('password'));
     $this->spool->flushQueue($smtpTransport);
 }
开发者ID:vodas,项目名称:praktykirepofinito,代码行数:7,代码来源:SpoolMailer.php

示例4: init

 protected function init($config = array())
 {
     $transport = new \Swift_SmtpTransport($this->smtpHost, $this->smtpPort, $this->smtpSecure);
     $transport->setUsername($this->smtpUser);
     $transport->setPassword($this->smtpPassword);
     $this->mailer = new \Swift_Mailer($transport);
     return parent::init();
 }
开发者ID:mpf-soft,项目名称:app-basic,代码行数:8,代码来源:SwiftMailer.php

示例5: createMailer

 /**
  * Changes mailer configuration on runtime
  *
  * @param MailerConfiguration $mailerConfiguration
  *
  * @return \Swift_Mailer
  */
 protected function createMailer(MailerConfiguration $mailerConfiguration)
 {
     $transport = new \Swift_SmtpTransport();
     $transport->setHost($mailerConfiguration->getHost());
     $transport->setPort($mailerConfiguration->getPort());
     $transport->setUsername($mailerConfiguration->getUser());
     $transport->setPassword($mailerConfiguration->getPass());
     return \Swift_Mailer::newInstance($transport);
 }
开发者ID:Sywooch,项目名称:WellCommerce,代码行数:16,代码来源:MailerHelper.php

示例6: __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

示例7:

 function send_breakin_alert($email, $password)
 {
     $transporter = new Swift_SmtpTransport('smtp.gmail.com', 465, 'ssl');
     $transporter->setUsername('');
     $transporter->setPassword('');
     $message = new Swift_Message($transporter);
     $message->setTo(array($email => $email));
     $message->setSubject("Note to Myself - Break-in Attempt");
     $message->addPart("Your password has been reset after 3 failed log-in attempts.</br>Your new password is <strong>{$password}</strong>", 'text/html');
     $message->setFrom("", "");
     $mailer = new Swift_Mailer($transporter);
     $mailer->send($message);
 }
开发者ID:TrevorBroderick,项目名称:bcit-courses,代码行数:13,代码来源:Mailer.php

示例8: __getSwiftMailer

 /**
  * @param $from
  * @return \Swift_Mailer
  */
 protected function __getSwiftMailer($from)
 {
     if (!isset($this->swiftMailers[$hash = md5(json_encode($from))])) {
         $transport = new \Swift_SmtpTransport(isset($from['smtpHost']) ? $from['smtpHost'] : '127.0.0.1', isset($from['smtpPort']) ? $from['smtpPort'] : 25, isset($from['smtpSecure']) ? $from['smtpSecure'] : false);
         if (isset($from['smtpUser'])) {
             $transport->setUsername($from['smtpUser']);
         }
         if (isset($from['smtpPassword'])) {
             $transport->setPassword($from['smtpPassword']);
         }
         $this->swiftMailers[$hash] = new \Swift_Mailer($transport);
     }
     return $this->swiftMailers[$hash];
 }
开发者ID:mpf-soft,项目名称:mpf,代码行数:18,代码来源:MailHelper.php

示例9: createSmtpMailer

 /**
  * @param string|null $host
  * @param int|null    $port
  * @param array|null  $headers
  * @param string|null $username
  * @param string|null $password
  * @param string|null $security
  * @return CM_Mail_Mailer
  */
 public function createSmtpMailer($host = null, $port = null, array $headers = null, $username = null, $password = null, $security = null)
 {
     $host = null !== $host ? (string) $host : 'localhost';
     $port = null !== $port ? (int) $port : 25;
     $headers = null !== $headers ? (array) $headers : [];
     $security = null !== $security ? (string) $security : null;
     $transport = new Swift_SmtpTransport($host, $port, $security);
     if (null !== $username) {
         $transport->setUsername((string) $username);
     }
     if (null !== $password) {
         $transport->setPassword((string) $password);
     }
     return new CM_Mail_Mailer($transport, $headers);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:24,代码来源:MailerFactory.php

示例10: execute

 public function execute(Request $request, $function)
 {
     switch ($function) {
         case 'verify-smtp':
             $smtp = new \Swift_SmtpTransport($request->input('smtp-server'), $request->input('smtp-port'), $request->input('smtp-ssl'));
             $smtp->setUsername($request->input('smtp-username'));
             $smtp->setPassword($request->input('smtp-password'));
             $smtp->start();
             $this->ajax_result['errno'] = 0;
             $this->ajax_result['html'] = 'OK';
             $this->ajax_result['smtp'] = $smtp->isStarted();
             //                $this -> ajax_result['errno'] = time() % 2;
             //                $this -> ajax_result['errmsg'] = 'chujnia jakas sie wydazyla';
             //                $this -> ajax_result['html'] = 'chujnia jakas sie wydazyla';
             break;
     }
     echo json_encode($this->ajax_result);
 }
开发者ID:stobys,项目名称:laravel5-work,代码行数:18,代码来源:SettingsController.php

示例11: connect

 /**
  * Connect to Mail server
  *
  * @param array $config
  * @throws \RuntimeException
  * @return \Swift_SmtpTransport
  */
 public function connect(array $config)
 {
     // save config
     $this->config = $config;
     try {
         if (!$this->connect) {
             $this->connect = new \Swift_SmtpTransport($config['server'], $config['port'], $config['socket']);
             $this->connect->setUsername($config['username']);
             $this->connect->setPassword($config['password']);
             $this->connect->start();
         }
         if ($this->connect->isStarted() === false) {
             throw new MailException('Mail connection failed! Check configurations');
         }
         return $this;
     } catch (\Exception $e) {
         throw new MailException($e->getMessage());
     }
 }
开发者ID:stanislav-web,项目名称:express-mailer,代码行数:26,代码来源:GMail.php

示例12: __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

示例13: createHandler

 /**
  * {@inheritdoc}
  */
 public function createHandler($config)
 {
     if (!isset($config['host'])) {
         throw new AcmeCliException('The SMTP host (key "host") is required in the email monitoring alert handler.');
     }
     if (!isset($config['to'])) {
         throw new AcmeCliException('The mail recipient (key "to") is required in the email monitoring alert handler.');
     }
     $config = array_merge(self::$defaults, $config);
     $transport = new \Swift_SmtpTransport($config['host'], $config['port'], $config['encryption']);
     if ($config['username']) {
         $transport->setUsername($config['username']);
     }
     if ($config['password']) {
         $transport->setPassword($config['password']);
     }
     $message = new \Swift_Message($config['subject']);
     $message->setFrom($config['from']);
     $handler = new SwiftMailerHandler(new \Swift_Mailer($transport), $message);
     return new FingersCrossedHandler($handler, $config['level']);
 }
开发者ID:acmephp,项目名称:acmephp,代码行数:24,代码来源:EmailHandlerBuilder.php

示例14: getSwiftMailer

 /**
  * @return \Swift_Mailer
  * @throws \Exception
  */
 public function getSwiftMailer()
 {
     if ($this->configuration['transport'] !== 'smtp') {
         throw new \Exception('The MailService only supports SMTP at the moment', 1456822674);
     }
     if ($this->configuration['smtp_encryption'] === 'none') {
         $this->configuration['smtp_encryption'] = NULL;
     }
     if (!$this->configuration['smtp_port']) {
         if ($this->configuration['smtp_encryption'] === 'ssl') {
             $this->configuration['smtp_port'] = '465';
         } else {
             $this->configuration['smtp_port'] = '587';
         }
     }
     $transport = new \Swift_SmtpTransport($this->configuration['smtp_host'], $this->configuration['smtp_port']);
     if (!empty($this->configuration['smtp_username'])) {
         $transport->setUsername($this->configuration['smtp_username']);
     }
     if (!empty($this->configuration['smtp_password'])) {
         $transport->setPassword($this->configuration['smtp_password']);
     }
     return \Swift_Mailer::newInstance($transport);
 }
开发者ID:smichaelsen,项目名称:php-salad-bowl,代码行数:28,代码来源:MailService.php

示例15: array

// the connection configuration
$dbParams = array('driver' => $dbConfiguration->getDriver(), 'user' => $dbConfiguration->getUsername(), 'password' => $dbConfiguration->getPassword(), 'dbname' => $dbConfiguration->getDatabaseName(), 'host' => $dbConfiguration->getHost(), 'port' => $dbConfiguration->getPort());
$eventManager = new Doctrine\Common\EventManager();
$timestampableListener = new Gedmo\Timestampable\TimestampableListener();
$eventManager->addEventSubscriber($timestampableListener);
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
$annotationMetadataConfiguration = Setup::createAnnotationMetadataConfiguration($paths, $debug, null, new ArrayCache(), false);
$entityManager = EntityManager::create($dbParams, $annotationMetadataConfiguration, $eventManager);
$helperSet = ConsoleRunner::createHelperSet($entityManager);
$logger = new Logger("hipay");
$logFilePath = $parameters['log.file.path'] ?: DEFAULT_LOG_PATH;
$logger->pushHandler(new StreamHandler($logFilePath));
$swiftTransport = new Swift_SmtpTransport($parameters['mail.host'], $parameters['mail.port'], $parameters['mail.security']);
if (isset($parameters['mail.username']) && isset($parameters['mail.password'])) {
    $swiftTransport->setUsername($parameters['mail.username']);
    $swiftTransport->setPassword($parameters['mail.password']);
}
$mailer = new Swift_Mailer($swiftTransport);
$messageTemplate = new Swift_Message();
$messageTemplate->setSubject($parameters['mail.subject']);
$messageTemplate->setTo($parameters['mail.to']);
$messageTemplate->setFrom($parameters['mail.from']);
$messageTemplate->setCharset('utf-8');
$logger->pushHandler(new SwiftMailerHandler($mailer, $messageTemplate, Logger::CRITICAL));
$logger->pushProcessor(new PsrLogMessageProcessor());
/** @var ValidatorInterface $validator */
$validator = Validation::createValidatorBuilder()->enableAnnotationMapping()->getValidator();
$miraklConfiguration = new MiraklConfiguration($parameters);
$hipayConfiguration = new HiPayConfiguration($parameters);
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) use($parameters, $logger) {
开发者ID:hipay,项目名称:hipay-wallet-cashout-mirakl-integration,代码行数:31,代码来源:bootstrap.php


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