IMAP मेलबॉक्स से फ़ोल्डर जानकारी प्राप्त करें
Contents
[
Hide
]
Aspose.Email - IMAP मेलबॉक्स से फ़ोल्डर जानकारी प्राप्त करें
Aspose.Email के साथ IMAP सर्वर से फ़ोल्डर जानकारी प्राप्त करना बहुत आसान है। ImapClient की listFolders() मेथड ImapFolderInfoCollection ऑब्जेक्ट लौटाती है जिसमें सर्वर के सभी फ़ोल्डर्स की जानकारी होती है। इस संग्रह के माध्यम से इटररेट करें और लूप में व्यक्तिगत फ़ोल्डर्स की जानकारी प्राप्त करें। यह मेथड ओवरलोडेड है। आप फ़ोल्डर का नाम पैरामीटर के रूप में पास करके उपफ़ोल्डर्स की सूची प्राप्त कर सकते हैं।
Java
ImapClient client = new ImapClient();
client.setHost("--server--"); //imap.secureserver.net,
client.setPort(993);
client.setUsername("--username--");
client.setPassword("--password--");
client.setSecurityOptions(SecurityOptions.Auto);
ImapFolderInfoCollection folderInfoColl = client.listFolders();
// Iterate through the collection to get folder info one by one
for (ImapFolderInfo folderInfo:folderInfoColl)
{
// Folder name
System.out.println("Folder name is: " + folderInfo.getName());
ImapFolderInfo folderExtInfo = client.listFolder(folderInfo.getName());
// New messages in the folder
System.out.println("New message count: " + folderExtInfo.getNewMessageCount());
// Check whether its read only
System.out.println("Is it readonly? " + folderExtInfo.getReadOnly());
// Total number of messages
System.out.println("Total number of messages: " + folderExtInfo.getTotalMessageCount());
}
चल रहा कोड डाउनलोड करें
नीचे उल्लेखित किसी भी सामाजिक कोडिंग साइट से IMAP मेलबॉक्स से फ़ोल्डर जानकारी प्राप्त करें डाउनलोड करें: