PHP Classes

fetching multiple emails

Recommend this page to a friend!

      POP3 e-mail client  >  POP3 e-mail client package blog  >  How Can PHP Read Emai...  >  All threads  >  fetching multiple emails  >  (Un) Subscribe thread alerts  
Subject:fetching multiple emails
Summary:how to fetch multiple emails using pop3
Messages:10
Author:sooraj h kumar
Date:2012-01-31 15:01:37
Update:2012-04-09 18:57:51
 

  1. fetching multiple emails   Reply   Report abuse  
Picture of sooraj h kumar sooraj h kumar - 2012-01-31 15:01:37
hai,
i am developing an application for fetching emails using pop3 but all the time i am getting only latest one email only.my requirement is fetching the latest 5 emails in my mailbox.
i am using the 'mime_parser.php' class for fetching emails.
can any one help me regarding this problem?

  2. Re: fetching multiple emails   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2012-02-01 04:44:35 - In reply to message 1 from sooraj h kumar
The RetrieveMessage function takes the number of the message to retrieve as parameter. Just change that number to retrieve different messages.

  3. Re: fetching multiple emails   Reply   Report abuse  
Picture of sooraj h kumar sooraj h kumar - 2012-02-01 14:38:57 - In reply to message 2 from Manuel Lemos
tanks that works for me..
but i hve another problm.i cannot fetch the mail content properly.The Retrieve message function doesnot returns the mail content in the proper way.

  4. Re: fetching multiple emails   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2012-02-01 21:02:19 - In reply to message 3 from sooraj h kumar
You can also use the GetMessage function to get the whole message with headers as a single string.

  5. Re: fetching multiple emails   Reply   Report abuse  
Picture of sooraj h kumar sooraj h kumar - 2012-02-02 11:10:27 - In reply to message 4 from Manuel Lemos
tanks,but i got an error "connection is not in 'GETMESSAGE' state while displaying each of the mails.

  6. Re: fetching multiple emails   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2012-02-02 18:42:14 - In reply to message 5 from sooraj h kumar
That is because you first need to call OpenMessage to tell which message you want to read.

You can also use the the class POP 3 stream handler function that allows you to access mailbox messages with PHP file functions like fopen, fread. Take a look at the browse_mailbox.php example.

  7. Re: fetching multiple emails   Reply   Report abuse  
Picture of Aravind Aravind - 2012-04-09 13:27:18 - In reply to message 2 from Manuel Lemos
what number I have to give to show all the messages in the RetrieveMessage

  8. Re: fetching multiple emails   Reply   Report abuse  
Picture of Aravind Aravind - 2012-04-09 13:44:28 - In reply to message 4 from Manuel Lemos
Hai
what arguments I have to send in that getmessage function
Thanks in advance,
Aravind

  9. Re: fetching multiple emails   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2012-04-09 18:56:19 - In reply to message 7 from Aravind
You can only retrieve one message at a time. Just increment the message number for each of the messages in the mailbox.

  10. Re: fetching multiple emails   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2012-04-09 18:57:52 - In reply to message 8 from Aravind
GetMessage method

- the $count argument indicates the number of bytes to be read from an opened message.
- The $message returns by reference the data read from the message.
- The $end_of_message argument returns by reference a boolean value indicated whether it was reached the end of the message.