php - IMAP server response -
I am developing my own webmail, I am using socket (PHP) to get the body of email I am getting a reply from the server:
* 1 EXISTS * 0 Recently * OK [UIDVALIDITY 1398151393] * OK [UIDX 15]? OK [Read-write] is complete * 1 FETCH (body [text] {12} message)
How can I only remove extra lines? Body of email for?
I think you have not read yet, take a look in particular.
You are sending many requests (and not want to send them tagging exclusively!) Before reading the answer. First 5 lines:
* 1 current * 0 recently * fine [utility 1398151393] * OK [UIDX 15]? OK [Read-write] Complete
All are answered in your order. The first 4 lines are Untag responses , describing the different aspects of the mailbox you choose. The 5th line is an tagged response because it is the prefix with the same tag that you have specified in the command (
? ) and thus the answer ends. Until you get the tag feedback you have to keep the lines in the form of reading and processing them.
You have shown the remaining rows:
* 1 is FETCH (body [text] {12} message)
all Your order related to the answer Again, as long as you have achieved the last tag feedback (which you did not show), it is important to keep reading and processing lines so that in the matter of what you are looking for, An additional complexity is that this answer includes an string literal (see). The
{12} string is the length of the string, followed by the CRLF, after which the character data is exactly 12 octets. So you have to look for it and process accordingly whenever you encounter it.
You can not just ignore arbitrary lines, you have to look at each and work accordingly. Their context and meaning are: Try something else instead:
$ soc = fsockopen ('192.168.56.101', 143); $ Request = fputs ($ Soak, "A1 login example@example.br 12345 \ r \ n"); // Unless you get an answer tagged with A1, // $ request = fputs ($ soc, "A2 select INBOX \ r \ n") for processing according to any untag responses; // Until you receive an answer tagged with A2, // $ processing = fputs ($ soc, "A3 FETCH 1 BODY [TEXT] \ r for processing according to any untagged responses \ N "); // Unless you receive an answer tagged with A3 // Any unprotected responses processing
Comments
Post a Comment