Announcement Announcement Module
Collapse
No announcement yet.
Flag a Email Message Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Flag a Email Message

    I am new to Spring Integration.

    I have a requirement to read mails from a IMAP compliant mail-server, process the contents and then mark them as READ.

    I am using imap-idle-channel-adapter. My service gets activated once a new mail arrives to the mailbox.

    BUT...

    The problem is I am unable to flag/mark the mail as READ / SEEN.

    So..

    My mailbox is full of UNREAD mail even though I have set the flag by javamail API.

    Kindly help me in this context.

    Source Code:
    MimeMessage mimeMessage = (MimeMessage) msg.getPayload();
    System.out.println(mimeMessage.getSubject());
    System.out.println(mimeMessage.getSentDate());
    //System.out.println(IOUtils.toString(mimeMessage.ge tInputStream()));

    System.out.println((mimeMessage.getFrom()[0]).toString());
    mimeMessage.setFlag(Flag.RECENT, false);
    mimeMessage.setFlag(Flag.ANSWERED, true);
    mimeMessage.setFlag(Flag.SEEN, true);

    mimeMessage.saveChanges();
    MailTransportUtils.closeFolder(mimeMessage.getFold er());
Working...
X