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