پشتیبانی از فرمان IMAP IDLE
Contents
[
Hide
]
API Aspose.Email 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");