Skip to content

What is the correct way to set incoming mail to quarantine? #18

@mkurkela

Description

@mkurkela

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions