Class GmailMessage

All Implemented Interfaces:
MimePart, Part, ReadableMime

public class GmailMessage extends IMAPMessage
A Gmail message. Adds methods to access Gmail-specific per-message data.
Since:
JavaMail 1.4.6
  • Constructor Details

    • GmailMessage

      protected GmailMessage(IMAPFolder folder, int msgnum)
      Constructor.
      Parameters:
      folder - the containing folder
      msgnum - the message sequence number
    • GmailMessage

      protected GmailMessage(Session session)
      Constructor, for use by IMAPNestedMessage.
      Parameters:
      session - the Session
  • Method Details

    • getMsgId

      public long getMsgId() throws MessagingException
      Return the Gmail unique message ID.
      Returns:
      the message ID
      Throws:
      MessagingException - for failures
    • getThrId

      public long getThrId() throws MessagingException
      Return the Gmail unique thread ID.
      Returns:
      the thread ID
      Throws:
      MessagingException - for failures
    • getLabels

      public String[] getLabels() throws MessagingException
      Return the Gmail labels associated with this message.
      Returns:
      array of labels, or empty array if none
      Throws:
      MessagingException - for failures
    • setLabels

      public void setLabels(String[] labels, boolean set) throws MessagingException
      Set/Unset the given labels on this message.
      Parameters:
      labels - the labels to add or remove
      set - true to add labels, false to remove
      Throws:
      MessagingException - for failures
      Since:
      JavaMail 1.5.5
    • clearCachedLabels

      public void clearCachedLabels()
      Clear any cached labels for this message. The Gmail labels for a messge will be cached when first accessed using either the fetch method or the getLabels method. Gmail provides no notification when the labels have been changed by another application so applications may need to clear the cache if accessing the labels for a message more than once while the Folder is open.
      Since:
      JavaMail 1.5.6