title: How to get seen/unseen status of IMAP message
body: <p>I've read over the go <a href="https://godoc.org/code.google.com/p/go-imap/go1/imap" rel="nofollow noreferrer">documentation</a> as well as the general imap <a href="https://www.rfc-editor.org/rfc/rfc3501" rel="nofollow noreferrer">documentation</a> but can't seem to find the correct way to get the status of a particular message - to know if it is marked as read or unread.</p>
  <p>Here's what I've got so far:</p>
  <pre><code>// 
  //Code that set up 'c' and 'cmd' ...
  //
  for cmd.InProgress() {
      // Wait for the next response (no timeout)
      c.Recv(-1)
  
      // Process command data
      for _, rsp = range cmd.Data {
          if err != nil {
              fmt.Println(err)
          }
          header := imap.AsBytes(rsp.MessageInfo().Attrs[&quot;RFC822.HEADER&quot;])  // Contains subject, from data
          uid := imap.AsNumber(rsp.MessageInfo().Attrs[&quot;UID&quot;])  // Message unique id
          body := imap.AsBytes(rsp.MessageInfo().Attrs[&quot;RFC822.TEXT&quot;])  // Message body
          //seenState := imap.AsBytes(rsp.MessageInfo().Attrs[&quot;Flags&quot;])
          if msg, err := mail.ReadMessage(bytes.NewReader(header)); msg != nil {
              if err != nil {
                  fmt.Println(err)
              }
              //START CUSTOM
              if strings.Contains(msg.Header.Get(&quot;Subject&quot;), genUUID()){
                  fmt.Println(rsp.Label)
                  fmt.Println(rsp.MessageInfo().Attrs[&quot;Flags&quot;])
                  fmt.Println(c.Status(&quot;INBOX&quot;, string(uid)))
              }
              //END CUSTOM
  </code></pre>
  <p>For output I get:</p>
  <pre><code>FETCH
  &lt;nil&gt;
  LAOYU10 STATUS &quot;INBOX&quot; (Þ) &lt;nil&gt;
  </code></pre>
  <p>The documentation that I've cited has led me to believe that at least one of my methods should be printing if the message is marked as unseen. What am I missing?</p>
  <p>EDIT:
  I am testing against an inbox (gmail) with four messages. The first two are read and second two are unread. Here is the output for all four messages.</p>
  <pre><code>FETCH
  &lt;nil&gt;
  SIHLB7 STATUS &quot;INBOX&quot; (Û) &lt;nil&gt;
  FETCH
  &lt;nil&gt;
  SIHLB8 STATUS &quot;INBOX&quot; (Ü) &lt;nil&gt;
  FETCH
  &lt;nil&gt;
  SIHLB9 STATUS &quot;INBOX&quot; (Ý) &lt;nil&gt;
  FETCH
  &lt;nil&gt;
  SIHLB10 STATUS &quot;INBOX&quot; (Þ) &lt;nil&gt;
  </code></pre>