本文整理汇总了PHP中imap_close函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_close函数的具体用法?PHP imap_close怎么用?PHP imap_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Logoff
function Logoff()
{
if ($this->_mbox) {
imap_close($this->_mbox);
debugLog("IMAP connection closed");
}
}
示例2: closeImap
protected function closeImap($inbox = null)
{
if (!$inbox) {
$inbox = $this->inbox;
}
imap_close($inbox);
}
示例3: authUser
/**
* Authenticates user
* @param string $username
* @param string $password
* @return boolean
*/
function authUser($username, $password)
{
// Returns true if the username and password work
// and false if they are wrong or don't exist.
$this->imapUsername = $username;
foreach ($this->imapHosts as $host) {
// Try each host in turn
$host = trim($host);
switch ($this->imapType) {
case "imapssl":
$host = '{' . $host . "/imap/ssl}INBOX";
break;
case "imapcert":
$host = '{' . $host . "/imap/ssl/novalidate-cert}INBOX";
break;
case "imaptls":
$host = '{' . $host . "/imap/notls}INBOX";
break;
default:
$host = '{' . $host . '}INBOX';
}
//error_reporting(0);
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
if ($connection) {
imap_close($connection);
return true;
}
}
$this->err_msg = translate('IMAP Authentication: no match');
return false;
// No match
}
示例4: GetIMAPContent
/**
* Gets IMAP content
*
* @param string $imapHost
* @param string $imapUser
* @param string $imapPassword
* @param \Swiftriver\Core\ObjectModel\Channel $channel
*
* @return $contentItems[]
*/
private function GetIMAPContent($imapHost, $imapUser, $imapPassword, $channel)
{
$imapResource = imap_open("{" . $imapHost . "}INBOX", $imapUser, $imapPassword);
//Open up unseen messages
$imapEmails = imap_search($imapResource, strtoupper($channel->subType));
$contentItems = array();
if ($imapEmails) {
//Put newest emails on top
rsort($imapEmails);
foreach ($imapEmails as $Email) {
//Loop through each email and return the content
$email_overview = imap_fetch_overview($imapResource, $Email, 0);
$email_message = imap_fetchbody($imapResource, $Email, 2);
$source_name = $imapUser;
$source = \Swiftriver\Core\ObjectModel\ObjectFactories\SourceFactory::CreateSourceFromIdentifier($source_name);
$source->name = $source_name;
$source->parent = $channel->id;
$source->type = $channel->type;
$source->subType = $channel->subType;
$item = \Swiftriver\Core\ObjectModel\ObjectFactories\ContentFactory::CreateContent($source);
$item->text[] = new \Swiftriver\Core\ObjectModel\LanguageSpecificText(null, $email_overview[0]->subject, array($email_message));
//the message
$item->link = null;
$item->date = $email_overview[0]->date;
$contentItems[] = $item;
}
imap_close($imapResource);
return $contentItems;
}
imap_close($imapResource);
return null;
}
示例5: emailDeliverFailBySubject
public static function emailDeliverFailBySubject($subject)
{
$mailcnf = "outlook.office365.com:993/imap/ssl/novalidate-cert";
$username = MAILACCOUNT;
$pw = MAILPASSWORD;
$conn_str = "{" . $mailcnf . "}INBOX";
$inbox = imap_open($conn_str, $username, $pw) or die('Cannot connect to mail: ' . imap_last_error());
/* grab emails */
$emails = imap_search($inbox, 'SUBJECT "Undeliverable: ' . $subject . '"');
$failedInfo = [];
/* if emails are returned, cycle through each... */
if ($emails) {
/* for every email... */
foreach ($emails as $email_number) {
/* get information specific to this email */
$body = imap_fetchbody($inbox, $email_number, 2);
$list = split('; ', $body);
$sender = $list[2];
$sender_email = explode("\n", $sender)[0];
array_push($failedInfo, trim($sender_email));
}
}
/* close the connection */
imap_close($inbox);
return $failedInfo;
}
示例6: Close
/**
* Close the connection to the mail server
*
* @param bool $empty_trash (default true) whether to empty the trash upon exit
*
*/
function Close($empty_trash = true)
{
if ($this->do_delete && $empty_trash) {
imap_expunge($this->mbox);
}
imap_close($this->mbox);
}
示例7: disconnect
protected function disconnect()
{
$imapStream = $this->getImapStream(false);
if ($imapStream && is_resource($imapStream)) {
imap_close($imapStream, $this->expungeOnDisconnect ? CL_EXPUNGE : 0);
}
}
示例8: closeStreamFunc
public static function closeStreamFunc()
{
if (self::$currentStream) {
AJXP_Logger::debug("Closing stream now!");
imap_close(self::$currentStream);
}
}
示例9: authenticate_imap
function authenticate_imap($user, $pass)
{
global $LOGIN_IMAP_CONNECTION;
global $AUTH_ERR;
if (hostname() == 'tauceti') {
$server = '{localhost:143/imap/tls/novalidate-cert}';
} elseif (hostname() == 'Daneel.dynamic.wondermill.com') {
$server = '{localhost:143/imap/notls}';
} else {
$server = '{localhost:143/imap/tls/novalidate-cert}';
}
if ($c = imap_open($server, $user, $pass, OP_HALFOPEN)) {
if (LOGIN_IMAP_KEEPCONNECTION) {
$LOGIN_IMAP_CONNECTION =& $c;
} else {
//debug('Closing connection');
imap_close($c);
}
return AUTH_SUCCESS;
} else {
if ($AUTH_ERR = imap_last_error()) {
return AUTH_SERVFAIL;
} else {
return AUTH_DENY;
}
}
}
示例10: readImapStatus
function readImapStatus($config, $savedStatus, $db)
{
$mbox = imap_open($config["imap_server"], $config["imap_user"], $config["imap_password"]);
$imapStatus = imap_status($mbox, $config["imap_server"], SA_ALL);
// Read message IDs of UNSEEN mails
$unseen = [];
if ($imapStatus->unseen > 0) {
$messages = imap_search($mbox, "UNSEEN");
foreach ($messages as $msgID) {
$msg = imap_headerinfo($mbox, $msgID);
$unseen[] = $msg->message_id;
}
}
imap_close($mbox);
//
$last_unseen = json_decode($savedStatus->unseen);
$new_message_found = false;
foreach ($unseen as $key => $value) {
// Does 'unseen' contain msgID we haven't seen before?
if (array_search($value, $last_unseen) === FALSE) {
$new_message_found = true;
}
}
// Current unseen list doesn't match saved one
if (count($unseen) != count($last_unseen) || $new_message_found) {
saveStatusToSqlite($db, "unseen", json_encode($unseen));
}
return $new_message_found;
}
示例11: disconnect
public function disconnect()
{
$imapStream = $this->getImapStream(false);
if ($imapStream && is_resource($imapStream)) {
imap_close($imapStream, CL_EXPUNGE);
}
}
示例12: authenticate
function authenticate($username, $passwd)
{
error_reporting(error_reporting() - 2);
if ($GLOBALS['phpgw_info']['server']['mail_login_type'] == 'vmailmgr') {
$username = $username . '@' . $GLOBALS['phpgw_info']['server']['mail_suffix'];
}
if ($GLOBALS['phpgw_info']['server']['mail_server_type'] == 'imap') {
$GLOBALS['phpgw_info']['server']['mail_port'] = '143';
} elseif ($GLOBALS['phpgw_info']['server']['mail_server_type'] == 'pop3') {
$GLOBALS['phpgw_info']['server']['mail_port'] = '110';
} elseif ($GLOBALS['phpgw_info']['server']['mail_server_type'] == 'imaps') {
$GLOBALS['phpgw_info']['server']['mail_port'] = '993';
} elseif ($GLOBALS['phpgw_info']['server']['mail_server_type'] == 'pop3s') {
$GLOBALS['phpgw_info']['server']['mail_port'] = '995';
}
if ($GLOBALS['phpgw_info']['server']['mail_server_type'] == 'pop3') {
$mailauth = imap_open('{' . $GLOBALS['phpgw_info']['server']['mail_server'] . '/pop3' . ':' . $GLOBALS['phpgw_info']['server']['mail_port'] . '}INBOX', $username, $passwd);
} elseif ($GLOBALS['phpgw_info']['server']['mail_server_type'] == 'imaps') {
// IMAPS support:
$mailauth = imap_open('{' . $GLOBALS['phpgw_info']['server']['mail_server'] . "/ssl/novalidate-cert" . ':993}INBOX', $username, $passwd);
} elseif ($GLOBALS['phpgw_info']['server']['mail_server_type'] == 'pop3s') {
// POP3S support:
$mailauth = imap_open('{' . $GLOBALS['phpgw_info']['server']['mail_server'] . "/ssl/novalidate-cert" . ':995}INBOX', $username, $passwd);
} else {
/* assume imap */
$mailauth = imap_open('{' . $GLOBALS['phpgw_info']['server']['mail_server'] . ':' . $GLOBALS['phpgw_info']['server']['mail_port'] . '}INBOX', $username, $passwd);
}
error_reporting(error_reporting() + 2);
if ($mailauth == False) {
return False;
} else {
imap_close($mailauth);
return True;
}
}
示例13: imapclose
function imapclose()
{
if (!$this->mbox) {
return false;
}
@imap_close($this->mbox);
}
示例14: check
public function check($touch = false)
{
$mbox = $this->connection();
#echo "<h1>Nachrichten in INBOX</h1><div style=\"overflow:auto;max-height:400px;\"><pre>";
$MC = imap_check($mbox);
$T = new HTMLTable(1, $touch ? "Mails" : "");
$T->setTableStyle("font-size:11px;");
$T->useForSelection();
$start = $MC->Nmsgs - 10;
if ($start < 1) {
$start = 1;
}
$result = imap_fetch_overview($mbox, "{$start}:{$MC->Nmsgs}", 0);
$result = array_reverse($result);
foreach ($result as $overview) {
#print_r($overview);
$T->addRow(array("\n\t\t\t\t<small style=\"color:grey;float:right;\">" . Util::CLDateParser($overview->udate) . "</small>\n\t\t\t\t" . str_replace("\"", "", $this->decodeBlubb($overview->from)) . "<br />\n\t\t\t\t<small style=\"color:grey;\">" . substr($this->decodeBlubb($overview->subject), 0, 50) . "</small>"));
$T->addCellEvent(1, "click", "\$j('#MailFrame').attr('src', './interface/rme.php?class=MailCheck&constructor=" . $this->getID() . "&method=showMailBody¶meters=\\'{$overview->uid}\\'');");
}
imap_close($mbox);
#echo "</pre></div>";
$BC = "";
if ($touch) {
$BC = new Button("Fenster\nschließen", "stop");
$BC->style("float:right;margin:10px;");
$BC->onclick(OnEvent::closePopup("MailCheck"));
}
echo "<div style=\"float:right;width:300px;\">";
echo $BC;
echo "<p>{$MC->Nmsgs} Nachricht" . ($MC->Nmsgs == 1 ? "" : "en") . "</p><div style=\"clear:both;\"></div>";
echo $T;
echo "</div>";
echo "\n\t\t\t<div style=\"border-right-style:solid;border-right-width:1px;width:699px;\" class=\"borderColor1\">\n\t\t\t\t<iframe id=\"MailFrame\" style=\"border:0px;width:699px;height:520px;\" src=\"./fheME/MailCheck/Home/index.html\"></iframe>\n\t\t\t</div>";
echo "<div style=\"clear:both;\"></div>";
}
示例15: handleJSON_getContent
function handleJSON_getContent($smarty, $module_name, $appletlist)
{
$respuesta = array('status' => 'success', 'message' => '(no message)');
// Leer credenciales a partir del usuario y el perfil asociado
global $arrConf;
$dbAcl = new paloDB($arrConf["elastix_dsn"]["acl"]);
$pACL = new paloACL($dbAcl);
$userId = $pACL->getIdUser($_SESSION['elastix_user']);
$mailCred = $this->leerPropiedadesWebmail($dbAcl, $userId);
if (count($mailCred) <= 0) {
$respuesta['status'] = 'error';
$respuesta['message'] = _tr("You don't have a webmail account");
} elseif (!$this->_checkEmailPassword("{$mailCred['login']}@{$mailCred['domain']}", isset($mailCred['password']) ? $mailCred['password'] : '')) {
$respuesta['status'] = 'error';
$respuesta['message'] = "{$mailCred['login']}@{$mailCred['domain']} " . _tr("does not exist locally or password is incorrect");
} else {
$imap = @imap_open("{localhost:143/notls}", "{$mailCred['login']}@{$mailCred['domain']}", isset($mailCred['password']) ? $mailCred['password'] : '');
if (!$imap) {
$respuesta['status'] = 'error';
$respuesta['message'] = _tr('Imap: Connection error');
} else {
$this->leerInformacionImap($smarty, $module_name, $imap, $respuesta);
imap_close($imap);
}
}
$json = new Services_JSON();
Header('Content-Type: application/json');
return $json->encode($respuesta);
}