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


PHP Zend_Mail::getDefaultTransport方法代码示例

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


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

示例1: __construct

 public function __construct($isException = false)
 {
     // Configuração de remetente
     $config = RW_Config::getApplicationIni();
     $this->_name = $config->cms->email->name;
     $this->_email = $config->cms->email->email;
     $this->_returnPath = $config->cms->email->returnPath;
     // Verifica se está em ambiente de teste
     if (APPLICATION_ENV != 'production') {
         $this->_name .= ' (teste local)';
         $this->_email = 'sistemas@realejo.com.br';
     }
     // Configuração de envio de email
     $default = Zend_Mail::getDefaultTransport();
     // Verifica se há transport a ser usado
     if (empty($default)) {
         if ($isException instanceof Zend_Mail_Transport_Abstract) {
             $transport = $isException;
         } else {
             $this->_type = $isException ? 'exception' : $config->cms->email->type;
             $this->_username = isset($config->cms->email->smtp) ? $config->cms->email->smtp->username : '';
             $this->_password = isset($config->cms->email->smtp) ? $config->cms->email->smtp->password : '';
             // Configura o método de envio
             if ($this->_type == 'exception') {
                 $transport = new Zend_Mail_Transport_Sendmail('-f' . $this->_returnPath);
                 // Envio do servidor local. Deve impedir que o cliente receba sem querer
             } elseif (APPLICATION_ENV != 'production') {
                 $transport = new Zend_Mail_Transport_Sendmail("-fsistemas@realejo.com.br");
                 // Configurações da Locaweb
             } elseif ($this->_type == 'locaweb') {
                 /*
                  * Return-Path padrão da Locaweb
                  * sendmail_path = /usr/sbin/sendmail -t -i -r'email@seudominio.com.br'
                  */
                 $transport = new Zend_Mail_Transport_Sendmail("-f{$this->_returnPath}");
                 // Configurações do GMail
             } elseif ($this->_type == 'gmail') {
                 $serverconfig = array('auth' => 'login', 'username' => $this->_username, 'password' => $this->_password, 'ssl' => 'ssl', 'port' => 465);
                 $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $serverconfig);
                 // Configuração genérica de SMTP
             } elseif ($this->_type == 'smtp') {
                 $serverconfig = array('auth' => 'login', 'username' => $this->_username, 'password' => $this->_password);
                 // Verifica se há SSL
                 if (isset($config->cms->email->smtp->ssl) && $config->cms->email->smtp->ssl != '') {
                     $serverconfig['ssl'] = $config->cms->email->smtp->ssl;
                 }
                 // veriufica se há uma porta definida
                 if (isset($config->cms->email->smtp->port) && $config->cms->email->smtp->port != '') {
                     $serverconfig['port'] = $config->cms->email->smtp->port;
                 }
                 // Configura o transport
                 $transport = new Zend_Mail_Transport_Smtp($config->cms->email->smtp->host, $serverconfig);
             } else {
                 throw new Exception('Tipo de envio <b>' . $this->_type . '</b> não definido em RW_Mail');
             }
         }
         // Grava o transport a ser usado para envio de emails
         Zend_Mail::setDefaultTransport($transport);
     }
 }
开发者ID:realejo,项目名称:library-zf1,代码行数:60,代码来源:Mail.php

示例2: setUp

 protected function setUp()
 {
     // backup static vars
     $this->_oldTransport = Zend_Mail::getDefaultTransport();
     $this->_oldFrom = Zend_Mail::getDefaultFrom();
     // set mail transport to testing
     Zend_Mail::setDefaultTransport($this->_transport = new Zle_Mail_Transport_Testing());
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:8,代码来源:MailTest.php

示例3: getEmailHeaders

 /**
  * Get email headers
  *
  * @return array
  */
 private function getEmailHeaders()
 {
     $transport = \Zend_Mail::getDefaultTransport();
     $headers = array();
     foreach (explode("\n", $transport->header) as $line) {
         if (strpos($line, ':') !== false) {
             list($name, $value) = explode(':', $line);
             $headers[$name] = $value;
         }
     }
     return $headers;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:17,代码来源:EmailServiceTest.php

示例4: _setTransportType

 protected function _setTransportType()
 {
     $defaultTransportType = Zend_Mail::getDefaultTransport();
     if ($defaultTransportType instanceof Zend_Mail_Transport_File) {
         $transportType = Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_FILE;
     } else {
         if ($defaultTransportType instanceof Zend_Mail_Transport_Smtp) {
             $transportType = Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_SMTP;
         } else {
             $transportType = Alekseon_MailTransport_Model_System_Config_Source_MailTransportTypes::MAIL_TARNSPORT_TYPE_DEFAULT;
         }
     }
     $this->getSentEmailModel()->setTransportType($transportType);
     return $this;
 }
开发者ID:danielwalterrodrigues,项目名称:asus,代码行数:15,代码来源:Template.php

示例5: testNumericRegisterDirectiveIsPassedOnCorrectly

 /**
  * @group ZF-8981
  */
 public function testNumericRegisterDirectiveIsPassedOnCorrectly()
 {
     $options = array('transport' => array('type' => 'sendmail', 'register' => '1'));
     // Culprit
     $resource = new Zend_Application_Resource_Mail(array());
     $resource->setBootstrap($this->bootstrap);
     $resource->setOptions($options);
     $resource->init();
     $this->assertTrue(Zend_Mail::getDefaultTransport() instanceof Zend_Mail_Transport_Sendmail);
 }
开发者ID:hjr3,项目名称:zf2,代码行数:13,代码来源:MailTest.php

示例6: getTransport

 /**
  * Gets the transport that will be used to send XF mails.
  * This will reflect explicit overrides that the get default method won't.
  *
  * @return Zend_Mail_Transport_Abstract
  */
 public static function getTransport()
 {
     if (!self::$_transportSetup) {
         self::setupTransport();
     }
     return Zend_Mail::getDefaultTransport();
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:13,代码来源:Mail.php


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