ecederstrand/exchangelib

Can junk mail rules be created by exchangelib?

kingfer30 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Hello, I would like to ask if there is an interface for creating junk rules through the API?

Describe the solution you'd like
I saw that the rule created by this rule is only valid in the rule list and not in the junk list.
image

Describe alternatives you've considered
By reading the code, I found a method "bulk_mark_as_junk", but the official document states that blocked emails need to already exist, and my scenario is that certain the person or domain is not sending me emails, but I need to configure it so that I receive emails properly and not get marked as junk.
image

Additional context
That is like this:
image

Is it possible to implement?

The inbox rule implementation in exchangelib uses the *InboxRule EWS services. For creation, specifically this one: https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/ff709537(v=exchg.140)

I don't know where this lands when you look at it in Outlook. You could try to create a junk rule in Outlook and use exchangelib to see if that rule is exposed via account.rules. If not, then EWS probably does not expose this type of rule.