php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62957 i need parameters list on imap_fetchbody for section
Submitted: 2012-08-28 13:00 UTC Modified: 2012-08-28 13:44 UTC
From: milindmore22 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.16 OS: Windows XP
Private report: No CVE-ID: None
 [2012-08-28 13:00 UTC] milindmore22 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.imap-fetchbody#refsect1-function.imap-fetchbody-parameters
---
I am trying to get emails from inbox of gmail sent to me by particular email id
although i got output but in strange format because of parameter section see below

imap_fetchbody ( resource $imap_stream , int $msg_number , string $section [, int $options = 0 ] )

please can you give me detail of parameters and what actually they do when i put 0 it gives me nothing when i put 1 gives me plain text when i put 2 gives me html with too many eqaul(=) signs

Test script:
---------------
<?php
set_time_limit(0);
$imap         = imap_open('{imap.gmail.com:993/imap/ssl}INBOX', 'youremail', 'yourpassword');
$subject     = 'searchbyemail@gmail.com';
$threads     = array();

//remove re: and fwd:
//$subject = trim(preg_replace("/Re\:|re\:|RE\:|Fwd\:|fwd\:|FWD\:/i", '', $subject));

//search for subject in current mailbox
$results = imap_search($imap, 'FROM "'.$subject.'"', SE_UID);


//because results can be false
if(is_array($results)) {
    //now get all the emails details that were found
    $emails = imap_fetch_overview($imap, implode(',', $results), FT_UID);
   	
    //foreach email
   
    foreach ($emails as $email) {
    
    	/* output the email header information */
        //add to threads
        //we use date as the key because later we will sort it
        $message.=imap_fetchbody($imap,$email->uid,2,FT_UID);
        $threads[strtotime($email->date)] = $email;
        $message.='<hr />';
    }
    
    
}
krsort($threads);
echo $message;
//echo '<pre>'.print_r($threads, true).'</pre>';
exit;
?> 

Expected result:
----------------
Hi Milind,

I haven't been able to check your mail. I should do it on Monday and able to call Adhish / you.

Regards,
Ajay

On Mon, Aug 13, 2012 at 3:51 PM, milind more <strange@gmail.in> wrote:

    Respected Sir,
    As per our discussion for the Student Information System, we have started working on it
    as per SDLC's first stage we have collected Requirement from you, please see attachment and clear out requirements also attached ER-Diagram for same please revert back with your opinion.

    -- 
    Regards,
    Milind More




-- 
Ajay Potnis
Home: +91-20-2539-4004
Cellular: +91-9423-531-321

Actual result:
--------------
Hi Milind,

I haven't been able to check your mail. I should do = it on Monday and able to call Adhish / you.

Regards,
Ajay
<= br>
On Mon, Aug 13, 2012 at 3:51 PM, milind m= ore <milind.more@synergysoft.in> wrote:

    Respected Sir,
    As per our discussion for = the Student Information System, we have started working on it
    as per SDL= C's first stage we have collected Requirement from you, please see atta= chment and clear out requirements also attached ER-Diagram for same please = revert back with your opinion.

    -- 
    Regards,
    Milind More




-- 
Ajay Potn= is
Home: +91-20-2539-4004
Cellular: +91-9423-531-321

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-28 13:44 UTC] aharvey@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 [2012-08-28 13:44 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 18:01:35 2024 UTC