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


PHP smtp::setPassword方法代码示例

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


在下文中一共展示了smtp::setPassword方法的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::setPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。