Source for file Smtp.php
Documentation is available at Smtp.php
* DotBoost Technologies Inc.
* DotKernel Application Framework
* @copyright Copyright (c) 2009 DotBoost Technologies (http://www.dotboost.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @version $Id: Smtp.php 158 2010-06-25 08:59:20Z teo $
* Alternate SMTP server mail() class
* @author DotKernel Team <team@dotkernel.com>
* @param string $to [optional]
* @param string $fromName [optional]
* @param string $fromEmail [optional]
* @param string $subject [optional]
public function __construct($to = null, $fromName = null, $fromEmail = null, $subject = null)
$this->db = Zend_Registry::get('database');
$this->smtpData = $this->getSMTP();
// check if we still have available SMTP connections for today
if(!empty($this->smtpData))
$mailConfigs = array('auth' => 'login',
'username' => $this->smtpData['smtpUsername'],
'password' => $this->smtpData['smtpPassword'],
'port' => $this->smtpData['smtpPort'],
'ssl' => $this->smtpData['smtpSsl']);
$this->transport = new Zend_Mail_Transport_Smtp($this->smtpData['smtpServer'], $mailConfigs);
* @return Zend_Mail_Transport_Smtp
* Get the current SMTP info for sending the email
$select = $this->db->select()
->from('emailTransporter',
'smtpUsername' => 'user',
'smtpPassword' => 'pass',
'smtpServer' => 'server',
->where('counter < capacity')
->where('isActive = ?','1')
$result = $this->db->fetchAll($select);
$where = array(" `date` < DATE_FORMAT( NOW( ) , '%Y-%m-%d' )","isActive = '1'");
$this->db->update('emailTransporter', array('counter'=> 0), $where);
$this->db->update('emailTransporter', array('date'=> new Zend_Db_Expr('NOW()')), $where);
$select->where("`date` = DATE_FORMAT( NOW( ) , '%Y-%m-%d' )");
$result = $this->db->fetchAll($select);
* Update the counter of the current transporter.
$this->db->update('emailTransporter', array('counter' => new Zend_Db_Expr('counter+1')), 'id = '. $id);
|