本文整理汇总了PHP中phpmailer::SmtpClose方法的典型用法代码示例。如果您正苦于以下问题:PHP phpmailer::SmtpClose方法的具体用法?PHP phpmailer::SmtpClose怎么用?PHP phpmailer::SmtpClose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpmailer
的用法示例。
在下文中一共展示了phpmailer::SmtpClose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phpmailer
//.........这里部分代码省略.........
// reset the mailer
$mailer->Priority = 3;
$mailer->CharSet = 'UTF-8';
// our default
$mailer->ContentType = "text/plain";
$mailer->Encoding = "8bit";
$mailer->From = "root@localhost";
$mailer->FromName = "Root User";
$mailer->Sender = "";
$mailer->Subject = "";
$mailer->Body = "";
$mailer->AltBody = "";
$mailer->ConfirmReadingTo = "";
$mailer->ClearAllRecipients();
$mailer->ClearReplyTos();
$mailer->ClearAttachments();
$mailer->ClearCustomHeaders();
return $mailer;
}
$prevkeepalive = $mailer->SMTPKeepAlive;
get_mailer('flush');
}
include_once $CFG->libdir . '/phpmailer/class.phpmailer.php';
$mailer = new phpmailer();
$counter = 1;
$mailer->Version = 'Moodle ' . $CFG->version;
// mailer version
$mailer->PluginDir = $CFG->libdir . '/phpmailer/';
// plugin directory (eg smtp plugin)
$mailer->CharSet = 'UTF-8';
// some MTAs may do double conversion of LF if CRLF used, CRLF is required line ending in RFC 822bis
// hmm, this is a bit hacky because LE should be private
if (isset($CFG->mailnewline) and $CFG->mailnewline == 'CRLF') {
$mailer->LE = "\r\n";
} else {
$mailer->LE = "\n";
}
if ($CFG->smtphosts == 'qmail') {
$mailer->IsQmail();
// use Qmail system
} else {
if (empty($CFG->smtphosts)) {
$mailer->IsMail();
// use PHP mail() = sendmail
} else {
$mailer->IsSMTP();
// use SMTP directly
if (!empty($CFG->debugsmtp)) {
$mailer->SMTPDebug = true;
}
$mailer->Host = $CFG->smtphosts;
// specify main and backup servers
$mailer->SMTPKeepAlive = $prevkeepalive;
// use previous keepalive
if ($CFG->smtpuser) {
// Use SMTP authentication
$mailer->SMTPAuth = true;
$mailer->Username = $CFG->smtpuser;
$mailer->Password = $CFG->smtppass;
}
}
}
return $mailer;
}
$nothing = null;
// keep smtp session open after sending
if ($action == 'buffer') {
if (!empty($CFG->smtpmaxbulk)) {
get_mailer('flush');
$m =& get_mailer();
if ($m->Mailer == 'smtp') {
$m->SMTPKeepAlive = true;
}
}
return $nothing;
}
// close smtp session, but continue buffering
if ($action == 'flush') {
if (isset($mailer) and $mailer->Mailer == 'smtp') {
if (!empty($mailer->SMTPDebug)) {
echo '<pre>' . "\n";
}
$mailer->SmtpClose();
if (!empty($mailer->SMTPDebug)) {
echo '</pre>';
}
}
return $nothing;
}
// close smtp session, do not buffer anymore
if ($action == 'close') {
if (isset($mailer) and $mailer->Mailer == 'smtp') {
get_mailer('flush');
$mailer->SMTPKeepAlive = false;
}
$mailer = null;
// better force new instance
return $nothing;
}
}