本文整理汇总了PHP中imap_qprint函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_qprint函数的具体用法?PHP imap_qprint怎么用?PHP imap_qprint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_qprint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_messages
/**
* Get messages according to a search criteria
*
* @param string search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default
* NB: Search criteria only affects IMAP mailboxes.
* @param string date format. Set to "Y-m-d H:i:s" by default
* @return mixed array containing messages
*/
public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s")
{
$msgs = imap_search($this->imap_stream, $search_criteria);
$no_of_msgs = $msgs ? count($msgs) : 0;
$messages = array();
for ($i = 0; $i < $no_of_msgs; $i++) {
// Get Message Unique ID in case mail box changes
// in the middle of this operation
$message_id = imap_uid($this->imap_stream, $msgs[$i]);
$header = imap_header($this->imap_stream, $message_id);
$date = date($date_format, $header->udate);
$from = $header->from;
$fromname = "";
$fromaddress = "";
$subject = "";
foreach ($from as $id => $object) {
if (isset($object->personal)) {
$fromname = $object->personal;
}
$fromaddress = $object->mailbox . "@" . $object->host;
if ($fromname == "") {
// In case from object doesn't have Name
$fromname = $fromaddress;
}
}
if (isset($header->subject)) {
$subject = $this->_mime_decode($header->subject);
}
$structure = imap_fetchstructure($this->imap_stream, $message_id);
$body = '';
if (!empty($structure->parts)) {
for ($j = 0, $k = count($structure->parts); $j < $k; $j++) {
$part = $structure->parts[$j];
if ($part->subtype == 'PLAIN') {
$body = imap_fetchbody($this->imap_stream, $message_id, $j + 1);
}
}
} else {
$body = imap_body($this->imap_stream, $message_id);
}
// Convert quoted-printable strings (RFC2045)
$body = imap_qprint($body);
array_push($messages, array('msg_no' => $message_id, 'date' => $date, 'from' => $fromname, 'email' => $fromaddress, 'subject' => $subject, 'body' => $body));
// Mark Message As Read
imap_setflag_full($this->imap_stream, $message_id, "\\Seen");
}
return $messages;
}
开发者ID:shukster,项目名称:Cuidemos-el-Voto,代码行数:56,代码来源:Imap.php
示例2: get_messages
/**
* Get messages according to a search criteria
*
* @param string search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default
NB: Search criteria only affects IMAP mailboxes.
* @param string date format. Set to "Y-m-d H:i:s" by default
* @return mixed array containing messages
*/
public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s")
{
$msgs = imap_search($this->imap_stream, $search_criteria);
$no_of_msgs = $msgs ? count($msgs) : 0;
$messages = array();
for ($i = 0; $i < $no_of_msgs; $i++) {
$header = imap_header($this->imap_stream, $msgs[$i]);
$date = date($date_format, $header->udate);
$from = $this->_mime_decode($header->fromaddress);
$subject = $this->_mime_decode($header->subject);
$structure = imap_fetchstructure($this->imap_stream, $msgs[$i]);
if (!empty($structure->parts)) {
for ($j = 0, $k = count($structure->parts); $j < $k; $j++) {
$part = $structure->parts[$j];
if ($part->subtype == 'PLAIN') {
$body = imap_fetchbody($this->imap_stream, $msgs[$i], $j + 1);
}
}
} else {
$body = imap_body($this->imap_stream, $msgs[$i]);
}
// Convert quoted-printable strings (RFC2045)
$body = imap_qprint($body);
array_push($messages, array('msg_no' => $msgs[$i], 'date' => $date, 'from' => $from, 'subject' => $subject, 'body' => $body));
}
return $messages;
}
开发者ID:ajturner,项目名称:ushahidi,代码行数:35,代码来源:Imap.php
示例3: get_part
function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false)
{
if (!$structure) {
$structure = imap_fetchstructure($stream, $msg_number);
}
if ($structure) {
if ($mime_type == $this->get_mime_type($structure)) {
if (!$part_number) {
$part_number = "1";
}
$text = imap_fetchbody($stream, $msg_number, $part_number);
if ($structure->encoding == 3) {
return imap_base64($text);
} else {
if ($structure->encoding == 4) {
return imap_qprint($text);
} else {
return $text;
}
}
}
if ($structure->type == 1) {
while (list($index, $sub_structure) = each($structure->parts)) {
if ($part_number) {
$prefix = $part_number . '.';
}
$data = $this->get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
}
}
return false;
}
开发者ID:rusoftware,项目名称:_NewSite,代码行数:35,代码来源:receivemail.class.php
示例4: download
function download($VAR)
{
if (empty($VAR['id'])) {
return false;
}
$id = $VAR['id'];
// get ticket id
$db =& DB();
$rs = $db->Execute(sqlSelect($db, array("ticket_attachment", "ticket"), "A.ticket_id,B.department_id,B.account_id", "A.id=::{$id}:: AND A.ticket_id=B.id"));
if (!$rs || $rs->RecordCount() == 0) {
return false;
}
// is this an admin?
global $C_auth;
if ($C_auth->auth_method_by_name("ticket", "view")) {
// get the data & type
$rs = $db->Execute(sqlSelect($db, "ticket_attachment", "*", "id=::{$id}::"));
// set the header
require_once PATH_CORE . 'file_extensions.inc.php';
$ft = new file_extensions();
$type = $ft->set_headers_ext($rs->fields['type'], $rs->fields['name']);
if (empty($type)) {
echo imap_qprint($rs->fields['content']);
} elseif (preg_match("/^text/i", $type)) {
echo imap_base64($rs->fields['content']);
} else {
echo imap_base64($rs->fields['content']);
}
exit;
}
}
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:31,代码来源:ticket_attachment.inc.php
示例5: _decodeMail
private function _decodeMail($encoding, $body)
{
switch ($encoding) {
case ENC7BIT:
return $body;
case ENC8BIT:
return $body;
case ENCBINARY:
return $body;
case ENCBASE64:
return imap_base64($body);
case ENCQUOTEDPRINTABLE:
return imap_qprint($body);
case ENCOTHER:
return $body;
default:
return $body;
}
}
开发者ID:rocwang,项目名称:incoming,代码行数:19,代码来源:SiteController.php
示例6: getdecodevalue
function getdecodevalue($message,$coding) {
switch($coding) {
case 0:
case 1:
$message = imap_8bit($message);
break;
case 2:
$message = imap_binary($message);
break;
case 3:
case 5:
$message=imap_base64($message);
break;
case 4:
$message = imap_qprint($message);
break;
}
return $message;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:19,代码来源:checkmail_functions.php
示例7: get_msg
function get_msg($imap_box, $email_number, $mime_type, $structure = false, $part_number = false)
{
if (!$structure) {
// ПЕРВЫЙ запуск, получение корня структуры
$structure = imap_fetchstructure($imap_box, $email_number);
}
$message = "";
if ($structure->subtype == $mime_type) {
//"CHARSET")
if (!$part_number) {
$part_number = "1";
}
$data = imap_fetchbody($imap_box, $email_number, $part_number);
//получить конкретную часть письма
if ($structure->encoding == 3) {
$data = base64_decode($data);
}
if ($structure->encoding == 4) {
$data = imap_qprint($data);
}
if ($structure->parameters[0]->value == "windows-1251") {
$data = mb_convert_encoding($data, 'utf-8', 'windows-1251');
}
if ($structure->parameters[0]->value == "koi8-r") {
$data = mb_convert_encoding($data, 'utf-8', 'koi8-r');
}
//echo "<br> Вложенная часть: " . $part_number . "<br>";
$message .= $data;
}
// Если письмо состоит из многа частей - разбираем каждую отдельно
if ($structure->parts) {
while (list($index, $sub_structure) = each($structure->parts)) {
if ($part_number) {
$prefix = $part_number . '.';
}
$message .= get_msg($imap_box, $email_number, $mime_type, $sub_structure, $prefix . ($index + 1));
}
// end while
}
// end if
return $message;
}
开发者ID:qwant50,项目名称:email-s-parser,代码行数:42,代码来源:get_exchange_v2.1.php
示例8: decodeBody
/**
* Attempts to Decode the message body. If a valid encoding is not passed then it will attempt to detect the encoding itself.
* @param $body
* @param int|null $encoding
* @return string
*/
public function decodeBody($body, $encoding = null)
{
switch ($encoding) {
case ENCBASE64:
return imap_base64($body);
case ENCQUOTEDPRINTABLE:
return imap_qprint($body);
case ENCBINARY:
return $body;
default:
// Let's check if the message is base64
if ($decoded = base64_decode($body, true)) {
return $decoded;
}
if ($this->isQuotedPrintable($body)) {
return imap_qprint($body);
}
return $body;
}
}
开发者ID:craigh411,项目名称:ImapMailManager,代码行数:26,代码来源:MessageDecoder.php
示例9: get_one_mail
function get_one_mail($number)
{
$mail = imap_headerinfo($this->connection, $number);
//echo "<hr/>";
//echo "mail nummer: ".$number."<br/>";
//echo "date: ".$mail->date."<br/>";
//echo "subject: ".$mail->subject."<br/>";
//echo "from-mailbox: ".$mail->from[0]->mailbox."<br/>";
//echo "from-host: ".$mail->from[0]->host."<br/>";
$this->mails[$number]["date"]["raw"] = $mail->date;
$this->mails[$number]["date"]["timestamp"] = strtotime($mail->date);
$last_char_1 = substr($mail->subject, -1, 1);
$cleansubject = $mail->subject;
$cleansubject = utf8_encode(imap_qprint($cleansubject));
$cleansubject = ereg_replace("=\\?ISO-8859-1\\?Q\\?", "", $cleansubject);
$cleansubject = ereg_replace("\\?=", "", $cleansubject);
$cleansubject = ereg_replace("_", " ", $cleansubject);
$last_char_2 = substr($cleansubject, -1, 1);
if ($last_char_1 != $last_char_2) {
$cleansubject = substr($cleansubject, 0, strlen($cleansubject) - 1);
}
//$cleansubject = ereg_replace("?", "", $cleansubject);
$this->mails[$number]["subject"] = $cleansubject;
$this->mails[$number]["mailbox"] = $mail->from[0]->mailbox;
$this->mails[$number]["host"] = $mail->from[0]->host;
$body = utf8_encode(imap_qprint(imap_fetchbody($this->connection, $number, "1")));
if ($body != "") {
$this->mails[$number]["text"] = $body;
}
$struct = imap_fetchstructure($this->connection, $number);
//print_r($struct);
$counter = 2;
while (imap_fetchbody($this->connection, $number, $counter) != "") {
$image = imap_fetchbody($this->connection, $number, $counter);
$this->mails[$number]["image"][$counter]["data"] = $image;
$parts = $counter - 1;
$this->mails[$number]["image"][$counter]["name"] = $struct->parts[$parts]->dparameters[0]->value;
$this->email_base64_to_file($number, $counter);
$counter++;
}
}
开发者ID:benthebear,项目名称:Moblog,代码行数:41,代码来源:email.class.php
示例10: get_part
public static function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false)
{
if (!$structure) {
$structure = imap_fetchstructure($stream, $msg_number);
}
if ($structure) {
if ($mime_type == self::get_mime_type($structure)) {
if (!$part_number) {
$part_number = "1";
}
$text = imap_fetchbody($stream, $msg_number, $part_number);
if ($structure->encoding == 3) {
return imap_base64($text);
} else {
if ($structure->encoding == 4) {
return imap_qprint($text);
} else {
return $text;
}
}
}
if ($structure->type == 1) {
while (list($index, $sub_structure) = each($structure->parts)) {
if ($part_number) {
$prefix = $part_number . '.';
} else {
$prefix = "";
}
$data = self::get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
// END OF WHILE
}
// END OF MULTIPART
}
// END OF STRUTURE
return false;
}
开发者ID:laiello,项目名称:time-travel,代码行数:40,代码来源:EmailUtil.php
示例11: get_plain_text_body
function get_plain_text_body($mbox, $msgNum, &$attachments = array())
{
$structure = imap_fetchstructure($mbox, $msgNum);
// only plain text
if ('PLAIN' == $structure->subtype) {
return trim(imap_qprint(imap_body($mbox, $msgNum)));
}
if (isset($structure->parts)) {
// get attachments
foreach ($structure->parts as $partNum => $part) {
if (in_array($part->subtype, array('JPEG', 'PNG', 'GIF'))) {
// oeh an image
$name = 'image-from-email-' . $msgNum . '.' . strtolower($part->subtype);
foreach ($part->parameters as $param) {
if ('NAME' == $param->attribute) {
$name = $param->value;
}
}
$data = imap_fetchbody($mbox, $msgNum, (string) ($partNum + 1));
file_put_contents($attachments[] = 'attachments/' . time() . '--' . $name, base64_decode($data));
}
}
// multipart (probably) -- look for plain text part
foreach ($structure->parts as $partNum => $part) {
if ('PLAIN' == $part->subtype) {
$body = imap_fetchbody($mbox, $msgNum, (string) ($partNum + 1));
return trim($body);
} else {
if ('ALTERNATIVE' == $part->subtype && isset($part->parts)) {
foreach ($part->parts as $subPartNum => $subPart) {
if ('PLAIN' == $subPart->subtype) {
$body = imap_fetchbody($mbox, $msgNum, $partNum + 1 . '.' . ($subPartNum + 1));
return trim($body);
}
}
}
}
}
}
}
开发者ID:rudiedirkx,项目名称:IMAP-reader,代码行数:40,代码来源:test.br-autohelpdesk.php
示例12: fetchBody
/**
* Fetches email body
*
* @param int $msgno Message number
* @return string
*/
protected function fetchBody($msgno)
{
$body = imap_fetchbody($this->connection, $msgno, '1', FT_PEEK);
$structure = imap_fetchstructure($this->connection, $msgno);
$encoding = $structure->parts[0]->encoding;
$charset = null;
foreach ($structure->parts[0]->parameters as $param) {
if ($param->attribute == 'CHARSET') {
$charset = $param->value;
break;
}
}
if ($encoding == ENCBASE64) {
$body = imap_base64($body);
} elseif ($encoding == ENCQUOTEDPRINTABLE) {
$body = imap_qprint($body);
}
if ($charset) {
$body = iconv($charset, "UTF-8", $body);
}
return $body;
}
开发者ID:kacer,项目名称:FakturoidPairing,代码行数:28,代码来源:EmailStatement.php
示例13: get_part
function get_part($imap, $uid, $mimetype, $structure = false, $partNumber = false)
{
if (!$structure) {
//$imap_uid = imap_uid ($imap, $uid);
//echo "$uid->".$uid;
$structure = imap_fetchstructure($imap, $uid, FT_UID);
}
//echo "<br/>structure-><pre>".print_r($structure)."</pre>";
if ($structure) {
if ($mimetype == get_mime_type($structure)) {
if (!$partNumber) {
$partNumber = 1;
}
$text = imap_fetchbody($imap, $uid, $partNumber, FT_UID);
switch ($structure->encoding) {
case 3:
return imap_base64($text);
case 4:
return imap_qprint($text);
default:
return $text;
}
}
// multipart
if ($structure->type == 1) {
foreach ($structure->parts as $index => $subStruct) {
$prefix = "";
if ($partNumber) {
$prefix = $partNumber . ".";
}
$data = get_part($imap, $uid, $mimetype, $subStruct, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
}
}
return false;
}
开发者ID:bhushansonar,项目名称:knewdog.com,代码行数:39,代码来源:list+-+Copy.php
示例14: __toString
public function __toString()
{
$encoding = $this->attachment->encoding;
switch ($encoding) {
case 0:
// 7BIT
// 7BIT
case 1:
// 8BIT
// 8BIT
case 2:
// BINARY
return $this->getBody();
case 3:
// BASE-64
return base64_decode($this->getBody());
case 4:
// QUOTED-PRINTABLE
return imap_qprint($this->getBody());
}
throw new Exception(sprintf('Encoding failed: Unknown encoding %s (5: OTHER).', $encoding));
}
开发者ID:kamaroly,项目名称:kigalilifeapp,代码行数:22,代码来源:IMAPAttachment.php
示例15: read
private function read()
{
$allMails = imap_search($this->conn, 'ALL');
if ($allMails) {
rsort($allMails);
foreach ($allMails as $email_number) {
$overview = imap_fetch_overview($this->conn, $email_number, 0);
$structure = imap_fetchstructure($this->conn, $email_number);
$body = '';
if (isset($structure->parts) && is_array($structure->parts) && isset($structure->parts[1])) {
$part = $structure->parts[1];
$body = imap_fetchbody($this->conn, $email_number, 2);
if ($part->encoding == 3) {
$body = imap_base64($body);
} else {
if ($part->encoding == 1) {
$body = imap_8bit($body);
} else {
$body = imap_qprint($body);
}
}
}
$body = utf8_decode($body);
$fromaddress = utf8_decode(imap_utf7_encode($overview[0]->from));
$subject = mb_decode_mimeheader($overview[0]->subject);
$date = utf8_decode(imap_utf8($overview[0]->date));
$date = date('Y-m-d H:i:s', strtotime($date));
$key = md5($fromaddress . $subject . $body);
//save to MySQL
$sql = "SELECT count(*) FROM EMAIL_INFORMATION WHERE IDMAIL = " . $this->id . " AND CHECKVERS = \"" . $key . "\"";
$resul = $this->pdo->query($sql)->fetch();
if ($resul[0] == 0) {
$this->pdo->prepare("INSERT INTO EMAIL_INFORMATION (IDMAIL,FROMADDRESS,SUBJECT,DATE,BODY,CHECKVERS) VALUES (?,?,?,?,?,?)");
$this->pdo->execute(array($this->id, $fromaddress, $subject, $date, $body, $key));
}
}
}
}
开发者ID:GPierre-Antoine,项目名称:projetphp,代码行数:38,代码来源:Email.php
示例16: get_part
function get_part($imap, $uid, $mimetype, $structure = false, $partNumber = false)
{
if (!$structure) {
$structure = imap_fetchstructure($imap, $uid, FT_UID);
}
if ($structure) {
if ($mimetype == get_mime_type($structure)) {
if (!$partNumber) {
$partNumber = 1;
}
$text = imap_fetchbody($imap, $uid, $partNumber, FT_UID);
switch ($structure->encoding) {
case 3:
return imap_base64($text);
case 4:
return imap_qprint($text);
default:
return $text;
}
}
/*/ multipart */
if ($structure->type == 1) {
foreach ($structure->parts as $index => $subStruct) {
$prefix = "";
if ($partNumber) {
$prefix = $partNumber . ".";
}
$imap = '';
$data = get_part($imap, $uid, $mimetype, $subStruct, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
}
}
return false;
}
开发者ID:linuxman,项目名称:uycodeka,代码行数:37,代码来源:GetBackup.php
示例17: decode
/**
* Decode given string with encoding in current string and convert it to UTF-8 from part charset
*
* @param $string
* @return string
*/
private function decode($string)
{
if (!$string) {
return $string;
}
//transfer encoding
switch (strtolower($this->contentTransferEncoding)) {
case "7bit":
$decodedString = mb_convert_encoding($string, "UTF-8", "auto");
break;
case "8bit":
$decodedString = imap_8bit($string);
break;
case "binary":
$decodedString = imap_base64(imap_binary($string));
break;
case "base64":
$decodedString = imap_base64($string);
break;
case "quoted-printable":
$decodedString = imap_qprint($string);
break;
default:
throw new \UnexpectedValueException('Cannot decode ' . $this->contentTransferEncoding);
}
//do not convert if string is attachment content
if ($this->disposition == "attachment") {
return $decodedString;
}
//charset encoding
//TODO add different charsets
$decodedString = quoted_printable_decode($decodedString);
if (in_array($this->charset, ['windows-1250', 'koi8-r'])) {
return iconv(strtoupper($this->charset), "UTF-8", $decodedString);
} else {
return mb_convert_encoding($decodedString, "UTF-8", strtoupper($this->charset));
}
}
开发者ID:artemevsin,项目名称:imap,代码行数:44,代码来源:EmbeddedPart.php
示例18: saveForwardAttachments
function saveForwardAttachments($id, $module, $file_details)
{
global $log;
$log->debug("Entering into saveForwardAttachments({$id},{$module},{$file_details}) method.");
global $adb, $current_user;
global $upload_badext;
require_once 'modules/Webmails/MailBox.php';
$mailbox = $_REQUEST["mailbox"];
$MailBox = new MailBox($mailbox);
$mail = $MailBox->mbox;
$binFile = sanitizeUploadFileName($file_details['name'], $upload_badext);
$filename = ltrim(basename(" " . $binFile));
//allowed filename like UTF-8 characters
$filetype = $file_details['type'];
$filesize = $file_details['size'];
$filepart = $file_details['part'];
$transfer = $file_details['transfer'];
$file = imap_fetchbody($mail, $_REQUEST['mailid'], $filepart);
if ($transfer == 'BASE64') {
$file = imap_base64($file);
} elseif ($transfer == 'QUOTED-PRINTABLE') {
$file = imap_qprint($file);
}
$current_id = $adb->getUniqueID("vtiger_crmentity");
$date_var = date('Y-m-d H:i:s');
//to get the owner id
$ownerid = $this->column_fields['assigned_user_id'];
if (!isset($ownerid) || $ownerid == '') {
$ownerid = $current_user->id;
}
$upload_file_path = decideFilePath();
file_put_contents($upload_file_path . $current_id . "_" . $filename, $file);
$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?)";
$params1 = array($current_id, $current_user->id, $ownerid, $module . " Attachment", $this->column_fields['description'], $adb->formatDate($date_var, true), $adb->formatDate($date_var, true));
$adb->pquery($sql1, $params1);
$sql2 = "insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?,?,?,?,?)";
$params2 = array($current_id, $filename, $this->column_fields['description'], $filetype, $upload_file_path);
$result = $adb->pquery($sql2, $params2);
if ($_REQUEST['mode'] == 'edit') {
if ($id != '' && $_REQUEST['fileid'] != '') {
$delquery = 'delete from vtiger_seattachmentsrel where crmid = ? and attachmentsid = ?';
$adb->pquery($delquery, array($id, $_REQUEST['fileid']));
}
}
$sql3 = 'insert into vtiger_seattachmentsrel values(?,?)';
$adb->pquery($sql3, array($id, $current_id));
return true;
$log->debug("exiting from saveforwardattachment function.");
}
开发者ID:hardikk,项目名称:HNH,代码行数:49,代码来源:Emails.php
示例19: chamado_mail2
public function chamado_mail2()
{
function mes($mes)
{
switch ($mes) {
case 'Jan':
$mes = '01';
break;
case 'Fev':
$mes = '02';
break;
case 'Mar':
$mes = '03';
break;
case 'Apr':
$mes = '04';
break;
case 'May':
$mes = '05';
break;
case 'Jun':
$mes = '06';
break;
case 'Jul':
$mes = '07';
break;
case 'Aug':
$mes = '08';
break;
case 'Sep':
$mes = '09';
break;
case 'Oct':
$mes = '10';
break;
case 'Nov':
$mes = '11';
break;
case 'Dec':
$mes = '12';
break;
}
return $mes;
}
$servidor = "mail.cartoriopostal.com.br";
$usuario = "[email protected]";
$senha = "a123d321";
@ini_set('display_errors', '0');
$mbox = imap_open("{" . $servidor . ":143/novalidate-cert}INBOX", $usuario, $senha);
$erro[] = imap_last_error();
if ($erro[0] == "") {
for ($i = 1; $i <= imap_num_msg($mbox); $i++) {
# **************************************************************
date_default_timezone_set('America/Sao_Paulo');
$headers = imap_header($mbox, $i);
$email = $headers->from[0]->mailbox . '@' . $headers->from[0]->host;
if (substr_count($email, 'cartoriopostal') > 0 || substr_count($email, 'softfox') > 0) {
#***************************************************************
$data = str_replace(' ', ',', $headers->date);
$data = explode(',', $data);
$mes = mes($data[3]);
$dia = $data[2] < 10 ? '0' . $data[2] : $data[2];
$data = $data[4] . ':' . $mes . ':' . $dia . ' ' . $data[5];
# **************************************************************
$usuario = $headers->from[0]->mailbox . '@' . $headers->from[0]->host;
$usuario = $this->f_usuario($usuario);
$usuario = count($usuario) == 0 ? 1 : $usuario[1];
# **************************************************************
$empresa = $headers->to[0]->mailbox . '@' . $headers->to[0]->host;
$empresa = $this->f_usuario($empresa);
$empresa = $empresa[0];
# **************************************************************
$h = "<b>De: </b>" . $headers->fromaddress . " [" . $headers->from[0]->mailbox . '@' . $headers->from[0]->host . "]<br />\n";
$h .= "<b>Para: </b>" . $headers->to[0]->personal . " [" . $headers->to[0]->mailbox . '@' . $headers->to[0]->host . "]<br />\n";
$h .= "<b>Enviada em: </b>" . $headers->date . "<br />\n";
$h .= "<b>Assunto: </b>" . $headers->subject . "<br /><br />\n\n";
$msg = imap_qprint(imap_body($mbox, $i));
$msg = strip_tags($msg);
if (substr_count($msg, 'Content-ID') > 0) {
$msg = explode("Content-ID", $msg);
$msg = explode("\n", $msg[0]);
} else {
$msg = explode("\n", $msg);
}
$mensagem = '';
for ($k = 0; $k < count($msg); $k++) {
$msg[$k] = str_replace(' ', ' ', $msg[$k]);
$msg[$k] = trim($msg[$k]);
if (strlen(trim($msg[$k])) > 0) {
$cont = $this->LimparLinha($msg[$k]);
if ($cont == 0 && strlen(trim($msg[$k])) > 0) {
if (substr_count($msg[$k], 'De: ') > 0) {
if (substr_count($msg[$k], '@cartoriopostal.com.br') > 0) {
$k = count($msg);
} else {
$mensagem .= $msg[$k] . "<br /><br />\n\n";
}
} else {
$mensagem .= $msg[$k] . "<br /><br />\n\n";
}
//.........这里部分代码省略.........
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:101,代码来源:ChamadoDAO.php
示例20: decode
function decode($text, $encoding)
{
switch ($encoding) {
case 1:
$text = imap_8bit($text);
break;
case 2:
$text = imap_binary($text);
break;
case 3:
// imap_base64 implies strict mode. If it refuses to decode the
// data, then fallback to base64_decode in non-strict mode
$text = ($conv = imap_base64($text)) ? $conv : base64_decode($text);
break;
case 4:
$text = imap_qprint($text);
break;
}
return $text;
}
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:20,代码来源:class.mailfetch.php
注:本文中的imap_qprint函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论