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


PHP smtp::setEnvelopeTo方法代碼示例

本文整理匯總了PHP中smtp::setEnvelopeTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP smtp::setEnvelopeTo方法的具體用法?PHP smtp::setEnvelopeTo怎麽用?PHP smtp::setEnvelopeTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在smtp的用法示例。


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

示例1: handleMail


//.........這裏部分代碼省略.........
                     }
                     if (is_array($attachment)) {
                         foreach ($attachment as $key => $fileAttach) {
                             if (file_exists( $fileAttach )) {
                                 $oPHPMailer->AddAttachment( $fileAttach, is_int( $key ) ? '' : $key );
                             }
                         }
                     }
 
                     foreach ($this->fileData['envelope_to'] as $sEmail) {
                         if (strpos( $sEmail, '<' ) !== false) {
                             preg_match( $this->longMailEreg, $sEmail, $matches );
                             $sTo = trim( $matches[3] );
                             $sToName = trim( $matches[1] );
                             $oPHPMailer->AddAddress( $sTo, $sToName );
                         } else {
                             $oPHPMailer->AddAddress( $sEmail );
                         }
                     }
 
                     //CC
                     foreach ($this->fileData['envelope_cc'] as $sEmail) {
                         if (strpos( $sEmail, '<' ) !== false) {
                             preg_match( $this->longMailEreg, $sEmail, $matches );
                             $sTo = trim( $matches[3] );
                             $sToName = trim( $matches[1] );
                             $oPHPMailer->AddCC( $sTo, $sToName );
                         } else {
                             $oPHPMailer->AddCC( $sEmail );
                         }
                     }
 
                     //BCC
                     foreach ($this->fileData['envelope_bcc'] as $sEmail) {
                         if (strpos( $sEmail, '<' ) !== false) {
                             preg_match( $this->longMailEreg, $sEmail, $matches );
                             $sTo = trim( $matches[3] );
                             $sToName = trim( $matches[1] );
                             $oPHPMailer->AddBCC( $sTo, $sToName );
                         } else {
                             $oPHPMailer->AddBCC( $sEmail );
                         }
                     }
 
                     $oPHPMailer->IsHTML($this->fileData["contentTypeIsHtml"]);
 
                     if ( $this->config['MESS_ENGINE'] == 'MAIL') {
                         $oPHPMailer->WordWrap = 300;
                     }
 
                     if ($oPHPMailer->Send()) {
                         $this->error = '';
                         $this->status = 'sent';
                     } else {
                         $this->error = $oPHPMailer->ErrorInfo;
                         $this->status = 'failed';
                     }
                     break;
                 case 'OPENMAIL':
                     G::LoadClass( 'package' );
                     G::LoadClass( 'smtp' );
                     $pack = new package( $this->fileData );
                     $header = $pack->returnHeader();
                     $body = $pack->returnBody();
                     $send = new smtp();
                     $send->setServer( $this->config['MESS_SERVER'] );
                     $send->setPort( $this->config['MESS_PORT'] );
                     $send->setUsername( $this->config['MESS_ACCOUNT'] );
 
                     $passwd = $this->config['MESS_PASSWORD'];
                     $passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
                     $auxPass = explode( 'hash:', $passwdDec );
 
                     if (count( $auxPass ) > 1) {
                         if (count( $auxPass ) == 2) {
                             $passwd = $auxPass[1];
                         } else {
                             array_shift( $auxPass );
                             $passwd = implode( '', $auxPass );
                         }
                     }
 
                     $this->config['MESS_PASSWORD'] = $passwd;
                     $send->setPassword( $this->config['MESS_PASSWORD'] );
                     $send->setReturnPath( $this->fileData['from_email'] );
                     $send->setHeaders( $header );
                     $send->setBody( $body );
                     $send->setEnvelopeTo( $this->fileData['envelope_to'] );
                     if ($send->sendMessage()) {
                         $this->error = '';
                         $this->status = 'sent';
                     } else {
                         $this->error = implode( ', ', $send->returnErrors() );
                         $this->status = 'failed';
                     }
                     break;
             }
         }
     }
 }
開發者ID:rrsc,項目名稱:processmaker,代碼行數:101,代碼來源:class.spool.php


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