本文整理汇总了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);
}
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}