1

I'm writing some fairly unremarkable php code to retrieve email via IMAP from a high load server.

My pseudo-code so far:

imap_open(..)
get_message_ids(..)
foreach message_id {
   $header_info = imap_headerinfo(..)
   $header = imap_fetchheader(..)  // I need full headers
   $structure = imap_fetchstructure(..)
   foreach($structure->parts as $part)
      get_part();
}

imap_headerinfo(), imap_fetchheader() and imap_fetchstructure() all parse the email header.

Is the email header downloaded separately each time or is it cached?

If there is no caching, I'd rather just download the raw header once with imap_fetchheader() and parse it with user code.

3
  • 1
    it will be downloaded each time the function is called
    – user557846
    Oct 11, 2015 at 2:46
  • You'd rather write an email parser? Fun. Start with parsing the Date field. Just a chore in theory, but it'll take you a few days to handle the common syntax errors. Then you can decide whether to handle the uncommon ones.
    – arnt
    Oct 12, 2015 at 8:01
  • I'm was just going to use imap_rfc822_parse_headers() unless you know of any issues with it.
    – Mikey Top
    Oct 12, 2015 at 14:31

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.