本文整理汇总了PHP中imap_check函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_check函数的具体用法?PHP imap_check怎么用?PHP imap_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_check函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
public function fetch($delete = false)
{
$oImap = imap_open('{' . $this->mail_server . ':993/imap/ssl/notls/novalidate-cert}', $this->username, $this->password);
$oMailboxStatus = imap_check($oImap);
$aMessages = imap_fetch_overview($oImap, "1:{$oMailboxStatus->Nmsgs}");
$validMessages = array();
foreach ($aMessages as $oMessage) {
print "Trying message '" . $oMessage->subject . "'";
$fileContent = $fileType = '';
$geocoder = factory::create('geocoder');
$postCode = $geocoder->extract_postcode($oMessage->subject);
$fromName = null;
$fromEmail = null;
if (strpos($oMessage->from, '<')) {
$split = split('<', $oMessage->from);
//name - make sure name not an email address
$fromName = trim($split[0]);
if (valid_email($fromName)) {
$fromName = null;
}
//email
$fromEmail = trim(str_replace('>', '', $split[1]));
} else {
$fromEmail = $oMessage->from;
}
$images = array();
$messageStructure = imap_fetchstructure($oImap, $oMessage->msgno);
if (isset($messageStructure->parts)) {
$partNumber = 0;
foreach ($messageStructure->parts as $oPart) {
$partNumber++;
if ($oPart->subtype == 'PLAIN' && !$postCode) {
$messageContent = imap_fetchbody($oImap, $oMessage->msgno, $partNumber);
if ($oPart->encoding == 4) {
$messageContent = quoted_printable_decode($messageContent);
}
$postCode = geocoder::extract_postcode($messageContent);
} elseif ($oPart->encoding == 3 && in_array($oPart->subtype, array('JPEG', 'PNG'))) {
$oImage = null;
$encodedBody = imap_fetchbody($oImap, $oMessage->msgno, $partNumber);
$fileContent = base64_decode($encodedBody);
$oImage = imagecreatefromstring($fileContent);
if (imagesx($oImage) > $this->min_import_size && imagesy($oImage) > $this->min_import_size) {
array_push($images, $oImage);
}
$fileType = strtolower($oPart->subtype);
}
}
}
//add to the messages array
array_push($validMessages, array('postcode' => $postCode, 'images' => $images, 'file_type' => $fileType, 'from_address' => $fromAddress, 'from_email' => $fromEmail, 'from_name' => $fromName));
if ($delete) {
imap_delete($oImap, $oMessage->msgno);
}
}
imap_close($oImap, CL_EXPUNGE);
$this->messages = $validMessages;
}
示例2: free
public function free($util)
{
$stream = imap_open("{imap.club-internet.fr:993/imap/SSL}", $util, "wrasuxwr");
var_dump($stream);
$check = imap_check($stream);
$list = imap_list($stream, "{imap.club-internet.fr}", "*");
imap_createmailbox($stream, '{imap.club-internet.fr}brubru');
$getmailboxes = imap_getmailboxes($stream, "{imap.club-internet.fr}", "*");
$headers = imap_headers($stream);
$num_msg = imap_num_msg($stream);
$status = imap_status($stream, "{imap.club-internet.fr:993/imap/SSL}INBOX", SA_ALL);
$messages = imap_fetch_overview($stream, "1:" . $num_msg);
$structure = imap_fetchstructure($stream, 2);
$body = utf8_encode(quoted_printable_decode(imap_body($stream, '2')));
// imap_delete($stream, '1');
// imap_expunge($stream);
return view('Imap.Imap')->with(compact('resource'))->with(compact('check'))->with(compact('list'))->with(compact('getmailboxes'))->with(compact('headers'))->with(compact('num_msg'))->with(compact('status'))->with(compact('errors'))->with(compact('messages'))->with(compact('structure'))->with(compact('body'));
}
示例3: get_mails
public function get_mails(Request $request)
{
$mbox = imap_open("{email.mindfiresolutions.com:143}INBOX", "saema.miftah@mindfiresolutions.com", "1mfmail2016#") or die("can't connect: " . imap_last_error());
$MC = imap_check($mbox);
$count = 0;
$count_total = $MC->Nmsgs;
$last_page = $count_total % 10;
$this->number_of_pages = ($count_total - $last_page) / 10;
$this->result = imap_fetch_overview($mbox, "1:{$MC->Nmsgs}", 0);
$i = 0;
foreach ($this->result as $overview) {
$message = imap_fetchbody($mbox, $overview->msgno, 1.1);
$this->msg[$i] = $message;
$i++;
\Cache::put($overview->msgno, $overview->subject, 5);
}
krsort($this->result);
/*This sorting does not help.Please use only rsort.*/
$str[0] = 'success';
$result_json = array();
$result_json['val'] = $this->result;
$result_json['num'] = $this->number_of_pages;
$result_json['total'] = $count_total;
return response()->json($result_json);
}
示例4: getInbox
public function getInbox($page = 1, $perPage = 25, $sort = null)
{
if (!$this->isConnect) {
return false;
}
$start = $page == 1 ? 0 : $page * $perPage - ($perPage - 1);
$order = 0;
$by = SORTDATE;
if (is_array($sort)) {
$order = $this->sortBy['order'][$sort[0]];
$by = $this->sortBy['by'][$sort[1]];
}
$sorted = imap_sort($this->stream, $by, $order);
$mails = array_chunk($sorted, $perPage);
$mails = $mails[$page - 1];
$mbox = imap_check($this->stream);
$inbox = imap_fetch_overview($this->stream, implode($mails, ','), 0);
if (!is_array($inbox)) {
return false;
}
if (is_array($inbox)) {
$temp_inbox = [];
foreach ($inbox as $msg) {
$temp_inbox[$msg->msgno] = $msg;
}
foreach ($mails as $msgno) {
$this->inbox[$msgno] = $temp_inbox[$msgno];
}
}
return $this->inbox;
}
示例5: store_email_into_folder
function store_email_into_folder($msg, $folder = 'SentFromDolibarr')
{
global $user, $db;
$mailboxconfig = new Usermailboxconfig($db);
$mailboxconfig->fetch_from_user($user->id);
$user->mailbox_imap_login = $mailboxconfig->mailbox_imap_login;
$user->mailbox_imap_password = $mailboxconfig->mailbox_imap_password;
$user->mailbox_imap_host = $mailboxconfig->mailbox_imap_host;
$user->mailbox_imap_port = $mailboxconfig->mailbox_imap_port;
$user->mailbox_imap_ssl = $mailboxconfig->mailbox_imap_ssl;
$user->mailbox_imap_ssl_novalidate_cert = $mailboxconfig->mailbox_imap_ssl_novalidate_cert;
$user->mailbox_imap_ref = $mailboxconfig->get_ref();
$user->mailbox_imap_connector_url = $mailboxconfig->get_connector_url();
$mbox = imap_open($user->mailbox_imap_connector_url . $folder, $user->mailbox_imap_login, $user->mailbox_imap_password);
$check = imap_check($mbox);
$before = $check->Nmsgs;
$result = imap_append($mbox, $user->mailbox_imap_connector_url . $folder, $msg);
$check = imap_check($mbox);
$after = $check->Nmsgs;
if ($result == FALSE) {
if (imap_createmailbox($mbox, imap_utf7_encode($user->mailbox_imap_ref . $folder))) {
$mbox = imap_open($user->mailbox_imap_connector_url . $folder, $user->mailbox_imap_login, $user->mailbox_imap_password);
$check = imap_check($mbox);
$before = $check->Nmsgs;
$result = imap_append($mbox, $user->mailbox_imap_connector_url . $folder, $msg);
$check = imap_check($mbox);
$after = $check->Nmsgs;
}
}
imap_close($mbox);
}
示例6: pop3_list
function pop3_list($connection, $message = "")
{
if (!isset($result)) {
$result = array();
}
if ($message) {
$range = $message;
} else {
$MC = @imap_check($connection);
if ($MC) {
$range = "1:" . $MC->Nmsgs;
} else {
$range = "1:0";
}
}
$response = @imap_fetch_overview($connection, $range);
if ($response) {
$result = array();
foreach ($response as $msg) {
$result[$msg->msgno] = (array) $msg;
}
} else {
$result = array();
}
return $result;
}
示例7: 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>";
}
示例8: imapCheck
/**
* Checkt die Anzahl Messages in einer Mailbox
* return array
*/
public function imapCheck()
{
if ($this->imap === null) {
throw new IMAPException(__METHOD__ . ' not connected');
}
$this->imapPing(true);
return imap_check($this->imap);
}
示例9: check
/**
* @return stdClass
*/
public function check()
{
$info = imap_check($this->stream);
if (FALSE === $info) {
throw new Exception('Check failed: ' . imap_last_error());
}
return $info;
}
示例10: imap_count_unread
/**
* Returns a unified count of unread e-mails.
*
* @access public
* @static
* @return void
*/
public static function imap_count_unread()
{
$total_messages = 0;
foreach (static::$_imap_connections as $connection) {
$imap_object = imap_check($connection);
$total_messages = $total_messages + (int) $imap_object->Nmsgs;
}
return $total_messages;
}
示例11: check
public function check()
{
debug::output("Starting Check...");
$object = imap_check($this->imap);
if (!is_object($object)) {
throw new emailException(imap_last_error($this->imap), imap_errors($this->imap));
} else {
return $object;
}
}
示例12: getImapCheck
/**
* Get information about authorization
* @access public
* @return object|bool
*/
public function getImapCheck()
{
if ($this->_connectionCheck != null) {
return $this->_connectionCheck;
}
if ($this->isAuth()) {
return imap_check($this->_connection);
}
return false;
}
示例13: update
public function update()
{
if (isset($this->feed)) {
$this->infoUpdate = imap_check($this->feed);
if (!$this->infoUpdate) {
throw new Exception('Error on update', 20003);
}
$this->postsOverview = imap_fetch_overview($this->feed, "1:{$this->infoUpdate->Nmsgs}", 0);
}
}
示例14: getMessages
/**
* @return array
*/
public function getMessages()
{
$messages = array();
$info = imap_check($this->connect());
$range = "1:" . $info->Nmsgs;
$responses = imap_fetch_overview($this->connect(), $range);
foreach ($responses as $message) {
$messages[$message->msgno] = new Message($this, $message->msgno, $message);
}
return $messages;
}
示例15: getMails
function getMails($email, $passw, $numRegs)
{
global $arrLang;
$counter = 0;
if ($email != '' && $passw != '') {
$imap = imap_open("{localhost:143/notls}INBOX", $email, $passw);
} else {
return $arrLang["You don't have a webmail account"];
}
if (!$imap) {
return $arrLang["Imap: Connection error"];
}
$tmp = imap_check($imap);
if ($tmp->Nmsgs == 0) {
return $arrLang["You don't recibed emails"];
}
$result = imap_fetch_overview($imap, "1:{$tmp->Nmsgs}", 0);
$mails = array();
//print_r($result);
foreach ($result as $overview) {
$mails[] = array("seen" => $overview->seen, "recent" => $overview->recent, "answered" => $overview->answered, "date" => $overview->date, "from" => $overview->from, "subject" => $overview->subject);
}
imap_close($imap);
$mails = array_slice($mails, -$numRegs, $numRegs);
krsort($mails);
$content = "";
/*
foreach($mails as $value){
$temp = $arrLang["mail recived"];
$temp = str_replace("{source}",$value["from"],$temp);
$temp = str_replace("{date}",$value["date"],$temp);
$temp = str_replace("{subject}",$value["subject"],$temp);
$b = ($value["seen"] or $value["answered"])?false:true;
if($b)
$temp = "<b>$temp</b>";
$content.=$temp."<br>";
}
return $content;*/
//print_r($mails);
$temp = '';
foreach ($mails as $index => $value) {
$b = ($value["seen"] or $value["answered"]) ? false : true;
if ($b) {
$temp .= "<font color='#000080' size='1'>" . $value['date'] . "</font> ";
$temp .= "<font size='1'>" . "From: " . substr($value['from'], 0, 50) . "</font> ";
$temp .= "<font size='1'>" . "Subject: " . substr($value['subject'], 0, 30) . "</font><br>";
}
}
return "<b>" . $temp . "</b>";
}