I was trying set some some incoming emails to quarantine
As the Quarantine class did not have encode method, I tried to do my own class derived from Quarantine class that defines the encode method.
class MyQuarantine(ppm.Quarantine):
def encode(self) -> Payload:
return Payload(self.response_char)
...
...
async def on_end_of_message(cmd: ppm.EndOfMessage) -> ppm.VerdictOrContinue:
if quarantine.get():
return MyQuarantine();
return ppm.Continue()
I can successfully reject the message by replacing the return MyQuarantine() line with
return ppm.RejectWithCode(primary_code=(5, 7, 1), text="Blocked address")