title: PHP IMAP retrieve all recipients in To address
body: <p>Using PHP IMAP I am able to download all my messages attachments etc from gmail. But when there are multiple recipients in the to address I am only getting a single address. Let me explain it more clearly. </p>
  
  <p>Suppose I have an email address example@gmail.com from where I am downloading all the messages. Now when test@gmail.com sends an email to me I am getting example@gmail.com in the toaddress using function imap_headerinfo. But when test@gmail.com sends the mail to example@gmail.com and example_1@gmail.com then I am not getting this example_1@gmail.com in toaddress or reply_toaddress or cc etc. Below is my sample output for a message</p>
  
  <pre><code>$header = imap_headerinfo($mbox, $msgno);
  
  
  stdClass Object
  (
    [date] =&gt; Tue, 10 Sep 2013 13:37:49 +0530
    [Date] =&gt; Tue, 10 Sep 2013 13:37:49 +0530
    [subject] =&gt; reply all test
    [Subject] =&gt; reply all test
    [message_id] =&gt; &lt;CACYeE9OEr+9z-Q5BR69sC=nJR_qQps69-VKWxkL6j2hqKEBo2w@mail.gmail.com&gt;
    [toaddress] =&gt; example@gmail.com
    [to] =&gt; Array
      (
          [0] =&gt; stdClass Object
              (
                  [mailbox] =&gt; example
                  [host] =&gt; gmail.com
              )
  
      )
  
    [fromaddress] =&gt; Test &lt;test@gmail.com&gt;
    [from] =&gt; Array
      (
          [0] =&gt; stdClass Object
              (
                  [personal] =&gt; Test
                  [mailbox] =&gt; test
                  [host] =&gt; gmail.com
              )
  
      )
  
    [reply_toaddress] =&gt; Test &lt;test@gmail.com&gt;
    [reply_to] =&gt; Array
      (
          [0] =&gt; stdClass Object
              (
                  [personal] =&gt; Test
                  [mailbox] =&gt; test
                  [host] =&gt; gmail.com
              )
  
      )
  
    [senderaddress] =&gt; Test &lt;test@gmail.com&gt;
    [sender] =&gt; Array
      (
          [0] =&gt; stdClass Object
              (
                  [personal] =&gt; Test
                  [mailbox] =&gt; test
                  [host] =&gt; gmail.com
              )
  
      )
  
    [Recent] =&gt;  
    [Unseen] =&gt; U
    [Flagged] =&gt;  
    [Answered] =&gt;  
    [Deleted] =&gt;  
    [Draft] =&gt;  
    [Msgno] =&gt; 34463
    [MailDate] =&gt; 10-Sep-2013 08:07:00 +0000
    [Size] =&gt; 2609
    [udate] =&gt; 1378800420
  )
  </code></pre>
  
  <p>I want all the recipients address so that I can use them in reply all.</p>
  
  <p>I can clearly see all the to address (AS Cc) in email clients like outlook, thunderbird etc when I click on reply all.</p>