Fix spam folder not found: add Junk Email to candidate names
This commit is contained in:
@@ -333,7 +333,7 @@ public sealed partial class InboxMonitorService : BackgroundService
|
||||
// 2. Search by name — try configured name plus common variants, two levels deep
|
||||
var candidates = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
_monitoring.SpamFolderName, "Junk", "Spam", "Junk E-mail", "Junk Mail", "Bulk Mail"
|
||||
_monitoring.SpamFolderName, "Junk", "Spam", "Junk Email", "Junk E-mail", "Junk Mail", "Bulk Mail"
|
||||
};
|
||||
|
||||
foreach (var ns in client.PersonalNamespaces)
|
||||
@@ -346,6 +346,9 @@ public sealed partial class InboxMonitorService : BackgroundService
|
||||
try { topLevel = await root.GetSubfoldersAsync(false, ct); }
|
||||
catch (Exception ex) { _logger.LogDebug(ex, "Could not list top-level folders"); continue; }
|
||||
|
||||
_logger.LogDebug("Folder list for {Account}: {Folders}",
|
||||
AccountName, string.Join(", ", topLevel.Select(f => f.FullName)));
|
||||
|
||||
foreach (var folder in topLevel)
|
||||
{
|
||||
if (candidates.Contains(folder.Name))
|
||||
@@ -358,6 +361,9 @@ public sealed partial class InboxMonitorService : BackgroundService
|
||||
try
|
||||
{
|
||||
var sub = await folder.GetSubfoldersAsync(false, ct);
|
||||
if (sub.Count > 0)
|
||||
_logger.LogDebug("Subfolders of {Parent}: {Subs}",
|
||||
folder.FullName, string.Join(", ", sub.Select(f => f.FullName)));
|
||||
var match = sub.FirstOrDefault(f => candidates.Contains(f.Name));
|
||||
if (match != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user