當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Mail_Protocol_Smtp類代碼示例

本文整理匯總了PHP中Zend_Mail_Protocol_Smtp的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Mail_Protocol_Smtp類的具體用法?PHP Zend_Mail_Protocol_Smtp怎麽用?PHP Zend_Mail_Protocol_Smtp使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Zend_Mail_Protocol_Smtp類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _sendMail

 /**
  * Send an email via the SMTP connection protocol
  *
  * The connection via the protocol adapter is made just-in-time to allow a
  * developer to add a custom adapter if required before mail is sent.
  *
  * @return void
  * @todo Rename this to sendMail, it's a public method...
  */
 public function _sendMail()
 {
     // If sending multiple messages per session use existing adapter
     if (!$this->_connection instanceof Zend_Mail_Protocol_Smtp) {
         // Check if authentication is required and determine required class
         $connectionClass = 'Zend_Mail_Protocol_Smtp';
         if ($this->_auth) {
             $connectionClass .= '_Auth_' . ucwords($this->_auth);
         }
         if (!class_exists($connectionClass)) {
             Zend_Loader::loadClass($connectionClass);
         }
         $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config));
         $this->_connection->connect();
         $this->_connection->helo($this->_name);
     } else {
         // Reset connection to ensure reliable transaction
         $this->_connection->rset();
     }
     // Set sender email address
     $this->_connection->mail($this->_mail->getReturnPath());
     // Set recipient forward paths
     foreach ($this->_mail->getRecipients() as $recipient) {
         $this->_connection->rcpt($recipient);
     }
     // Issue DATA command to client
     $this->_connection->data($this->header . Zend_Mime::LINEEND . $this->body);
 }
開發者ID:kobmaki,項目名稱:icingaweb2,代碼行數:37,代碼來源:Smtp.php

示例2: sendMassMailingAction

 /**
  * Sends mass mailing.
  * Prepares data and tests the recipients list before sendig emails.
  *
  * @param int $releaseID The release of the the newsletter to send.
  *
  * @return array Contains data corresponding to the send result.
  */
 public function sendMassMailingAction($releaseID = null)
 {
     $this->disableView();
     if (!$releaseID) {
         $releaseID = $_REQUEST['releaseID'];
     }
     //            $releaseID  = $this->view->params['releaseID'];
     // 1- Get all newsletter to send
     $dateTimeNow = date('Y-m-d H:i:s');
     $newsletterSelect = new NewsletterReleases();
     $select = $newsletterSelect->select()->setIntegrityCheck(false);
     $select->from('Newsletter_Releases')->join('Languages', 'L_ID = NR_LanguageID')->join('CategoriesIndex', 'CI_CategoryID = NR_CategoryID')->join('Newsletter_Models_Index', 'NMI_NewsletterModelID = NR_ModelID')->join('Newsletter_Models', 'NM_ID = NMI_NewsletterModelID')->where('CI_LanguageID = NR_LanguageID')->where('NMI_LanguageID = NR_LanguageID')->where('NR_Status <> 1')->where('NR_ID = ?', $releaseID);
     $newsletterData = $newsletterSelect->fetchAll($select);
     foreach ($newsletterData as $release) {
         $listSent = array();
         $listDest = array();
         $listIds = array();
         $mailLog = array();
         $date = new Zend_Date($release['NR_Date'], null, Zend_Registry::get('languageSuffix') == 'fr' ? 'fr_CA' : 'en_CA');
         $date_string = Cible_FunctionsGeneral::dateToString($date, Cible_FunctionsGeneral::DATE_LONG_NO_DAY, '.');
         $date_string_url = Cible_FunctionsGeneral::dateToString($date, Cible_FunctionsGeneral::DATE_SQL, '-');
         $releaseLanguage = $release['NR_LanguageID'];
         $this->view->assign('languageRelease', $releaseLanguage);
         $filteredData = $this->_countFilterMembers($release['NR_CollectionFiltersID'], $releaseLanguage);
         $members = $filteredData['members'];
         $selection = $filteredData['selection'];
         $dateTimeStart = date('Y-m-d H:i:s');
         $member_count = 0;
         $stats = array('action' => 'set', 'sentTo' => 0, 'targetedTotal' => 0);
         if ($release['NR_Status'] == 0 || $release['NR_Status'] == 3) {
             //Send to all recipient even if they have already received it
             $member_count = count($members);
         } elseif ($release['NR_Status'] == 2) {
             $member_count = count($members);
             $stats['action'] = 'increment';
             //Send to recipient who have not already received it
             $alreadyMembersRecievedSelect = new NewsletterReleasesMembers();
             $select = $alreadyMembersRecievedSelect->select()->where('NRM_ReleaseID = ?', $release['NR_ID']);
             $alreadyMembersRecievedData = $alreadyMembersRecievedSelect->fetchAll($select);
             $already_received_count = count($alreadyMembersRecievedData);
             $membersTmp = array();
             for ($i = 0; $i < $member_count; $i++) {
                 $received = "false";
                 for ($j = 0; $j < $already_received_count; $j++) {
                     if ($members[$i]['GP_MemberID'] == $alreadyMembersRecievedData[$j]['NRM_MemberID']) {
                         $received = "true";
                     }
                 }
                 if ($received == "false") {
                     array_push($membersTmp, $members[$i]);
                 }
             }
             $members = $membersTmp;
             $member_count = count($members);
         }
         $stats['targetedTotal'] = $member_count;
         if (!empty($members) && $member_count > 0) {
             $newsletterArticlesSelect = new NewsletterArticles();
             $select = $newsletterArticlesSelect->select();
             $select->where('NA_ReleaseID = ?', $release['NR_ID'])->order('NA_ZoneID')->order('NA_PositionID');
             $newsletterArticlesData = $newsletterArticlesSelect->fetchAll($select);
             $this->view->articles = $newsletterArticlesData->toArray();
             $registry = Zend_Registry::getInstance()->set('format', 'email');
             $config = Zend_Registry::get('config')->toArray();
             $nbMax = $config['massMailing']['packof'];
             $sleep = $config['massMailing']['sleep'];
             $server = $config['massMailing']['server'];
             $i = 0;
             set_time_limit(0);
             $emailValidator = new Zend_Validate_EmailAddress();
             $sentToCount = 0;
             $failedEmailAddress = array();
             for ($k = 0; $k < $member_count; $k++) {
                 try {
                     if ($i == $nbMax) {
                         $protocol->quit();
                         $protocol->disconnect();
                         sleep($sleep);
                         $i = 0;
                     }
                     if ($i == 0) {
                         $transport = new Zend_Mail_Transport_Smtp();
                         $protocol = new Zend_Mail_Protocol_Smtp($server);
                         $protocol->connect();
                         $protocol->helo($server);
                         $transport->setConnection($protocol);
                     }
                     $protocol->rset();
                     if ($emailValidator->isValid($members[$k]['GP_Email'])) {
                         $date = new Zend_Date($release['NR_Date'], null, Zend_Registry::get('languageSuffix') == 'fr' ? 'fr_CA' : 'en_CA');
                         $date_string = Cible_FunctionsGeneral::dateToString($date, Cible_FunctionsGeneral::DATE_LONG_NO_DAY, '.');
                         $date_string_url = Cible_FunctionsGeneral::dateToString($date, Cible_FunctionsGeneral::DATE_SQL, '-');
//.........這裏部分代碼省略.........
開發者ID:anunay,項目名稱:stentors,代碼行數:101,代碼來源:IndexController.php

示例3: _connectAndEhlo

 /**
  * Performs the initial EHLO dialog
  */
 protected function _connectAndEhlo()
 {
     $this->_protocol->responseBuffer = array('220 example.com ESMTP welcome', '250 Hello 127.0.0.1, go ahead');
     $this->_protocol->connect();
     $this->_protocol->helo();
     return $this->_protocol->dialog;
 }
開發者ID:omusico,項目名稱:logica,代碼行數:10,代碼來源:SmtpProtocolTest.php

示例4: auth

 /**
  * Perform PLAIN authentication with supplied credentials
  *
  * @return void
  */
 public function auth()
 {
     // Ensure AUTH has not already been initiated.
     parent::auth();
     $this->_send('AUTH PLAIN');
     $this->_expect(334);
     $this->_send(base64_encode(chr(0) . $this->_username . chr(0) . $this->_password));
     $this->_expect(235);
     $this->_auth = true;
 }
開發者ID:mtday,項目名稱:timesheet-system,代碼行數:15,代碼來源:Plain.php

示例5: auth

 /**
  * @todo Perform CRAM-MD5 authentication with supplied credentials
  *
  * @return void
  */
 public function auth()
 {
     // Ensure AUTH has not already been initiated.
     parent::auth();
     $this->_send('AUTH CRAM-MD5');
     $challenge = $this->_expect(334);
     $challenge = base64_decode($challenge);
     $digest = $this->_hmacMd5($this->_password, $challenge);
     $this->_send(base64_encode($this->_username . ' ' . $digest));
     $this->_expect(235);
     $this->_auth = true;
 }
開發者ID:netvlies,項目名稱:zf,代碼行數:17,代碼來源:Crammd5.php


注:本文中的Zend_Mail_Protocol_Smtp類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。