+1 vote


I use Mail.dll for mail operations. I get mail folder by following code for all email servers like Gmail, Yahoo, AOL etc

if (CheckForInternetConnections)
    var serverFolders = imapSetting.GetFolders();   //get Inbox, Sent, Draft, Trash, Bulk Mail.. But no Spam

I get all the folders in case of Gmail, Outlook or other server. When I try to get folders for Yahoo, it doesn't return me Spam Folder and details of it.

How can I get Spam mail folder in case of Yahoo?
Please suggest appropriate way.

by (3.0k points)

1 Answer

0 votes

As far as I know Yahoo's Junk/Spam folder is called 'Bulk Mail'. You can use CommonFolders class to get most common folders easily:

List<FolderInfo> folders = imap.GetFolders();

CommonFolders common = new CommonFolders(folders);
FolderInfo inbox = common.Inbox;
FolderInfo spam = common.Spam;

by (270k points)