Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ This applies as possible return type of all of the hooks below.
in order to use the `RemoveRecipient` manipulation.
- `can_quarantine` (default: False)

in order to use the `Quarantine` response in `hook_on_end_of_message`.
in order to use the `Quarantine` manipulation.


## `Command`s
Expand Down Expand Up @@ -142,6 +142,7 @@ This applies as possible return type of all of the hooks below.
- `ChangeHeader`
- `ReplaceBodyChunk`
- `ChangeMailFrom`
- `Quarantine`
- *AbstractResponse*
- *AbstractVerdict*
- *BaseVerdictNoData*
Expand All @@ -152,7 +153,6 @@ This applies as possible return type of all of the hooks below.
- *BaseReplyWithCode*
- `RejectWithCode`
- `TempFailWithCode`
- `Quarantine`
- *BaseResponseNoData*
- `Continue`
- `SkipToNextStage`
Expand Down
7 changes: 5 additions & 2 deletions src/purepythonmilter/protocol/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,18 @@ class DiscardMessage(BaseVerdictNoData):


@attrs.define(auto_attribs=False, kw_only=True)
class Quarantine(AbstractVerdict):
class Quarantine(AbstractManipulation):
"""
Put the message in the hold queue. Only valid at End of Message stage.
The reason text is ignored by Postfix at the time of writing.
https://github.com/vdukhovni/postfix/blob/fe4e81b23b3ee76c64de73d7cb250882fbaaacb9/postfix/src/milter/milter8.c#L1336
"""

response_char: ClassVar[bytes] = b"q" # SMFIR_QUARANTINE
reason: str
reason: str = attrs.field()

def encode(self) -> Payload:
return Payload(self.response_char + self.reason.encode() + b"\x00")


@attrs.define(auto_attribs=False, kw_only=True)
Expand Down