How to fix the SMTP address has no mailboxes associated with it error in .net dll
We are using a .net dll to read an outlook emails using exchnager url and the version. It was working fine untill couple of days ago then I started to get failed to extract mail id from outlook - the stmp address has no mailboxes with it.
Ther version is Exchange2013_Sp1 ( in the line findfolderResults the STMP error is getting)
The below codes are using to read:
public static string GetEmailUniqueIdAndCategory(string userName, string password, string emailAddress, string domain, string exchangeURL, string exchangeVersion, string strOutlookSubFolderName, string strOutlookDestFolderName, string strCategoryName)
{
var str = "";
try
{
//View size
int pageSize = 200;
int offset = 0;
//bool more = true;
List<string> lstMailEntryId = new List<String>();
ExchangeService service = GetExchangeService(userName, password, emailAddress, domain, exchangeURL, exchangeVersion);
ItemView ItemView = new ItemView(pageSize, offset);
PropertySet properties = new PropertySet(BasePropertySet.FirstClassProperties);
properties.RequestedBodyType = BodyType.HTML;
ItemView.PropertySet = properties;
FindItemsResults<Item> findResults;
FolderView view = new FolderView(100);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
view.PropertySet.Add(FolderSchema.DisplayName);
view.Traversal = FolderTraversal.Deep;
FindFoldersResults findFolderResults = service.FindFolders(WellKnownFolderName.MsgFolderRoot, view);
// find specific folder
foreach (Folder folder in findFolderResults)
{
// show FolderId of the folder "eAOB"
if (folder.DisplayName == strOutlookSubFolderName)
{
findResults = service.FindItems(folder.Id, ItemView);
var result = findResults.OrderBy(Item => Item.DateTimeReceived).ToList();
//foreach (var item in findResults)
foreach (var item in result)
{
EmailMessage emailMessage = (EmailMessage)item;
item.Load(properties);
bool subjectContains = Regex.IsMatch(item.Subject, "Mail Delivery Subsystem", RegexOptions.IgnoreCase);
bool bodyContains = Regex.IsMatch(item.Subject, "UnDeliverable", RegexOptions.IgnoreCase);
if (subjectContains || bodyContains)
{
FindFoldersResults finsSubFoldersResults = service.FindFolders(folder.Id, view);
foreach (Folder subFolder in finsSubFoldersResults)
{
if (subFolder.DisplayName == strOutlookDestFolderName)
{
// Move Undelivered mail to destination subfolder
item.Move(subFolder.Id);
}
}
}
else
{
//Categorizing the Mail
StringList existingCategories = item.Categories;
if (existingCategories.Count == 0)
{
item.Categories.Add(strCategoryName);
//Retrieving unread mail Unique Id's and mark the mail as read
str += item.Id + "~";
emailMessage.IsRead = true;
emailMessage.Update(ConflictResolutionMode.AutoResolve);
}
}
}
}
}
return str.Trim('~');
}
catch (Exception ex)
{
return "Exception : " + ex.Message;
}
}
```Help this issue to resolve as soon as possible