IMAP IDLE 명령 지원

Contents
[ ]

Aspoe.Email API ImapClient 서버에 연결을 열고 이메일 메시지 도착을 기다리는 기능을 제공합니다. 이를 통해 들어오는 이메일을 위해 서버를 반복적으로 폴링하는 것을 피할 수 있습니다. 다음 코드 스니펫은 IMAP Idle 명령 지원 방법을 보여줍니다.

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// Connect and log in to IMAP
ImapClient client = new ImapClient("imap.domain.com", "username", "password");

client.startMonitoring(new ImapMonitoringEventHandler() {
    public void invoke(Object sender, ImapMonitoringEventArgs e) {
        System.out.println(e.getNewMessages().length);
        System.out.println(e.getDeletedMessages().length);
    }
});
client.stopMonitoring("Inbox");