add delrcpt

This commit is contained in:
2021-09-21 00:55:54 +02:00
parent f4f26f08fd
commit 6333a0913d
2 changed files with 11 additions and 1 deletions

View File

@@ -192,6 +192,15 @@ class ModifyMilter(Milter.Base):
def replacebody(self):
self._replacebody = True
def delrcpt(self, rcpts):
"Remove recipient. May be called from eom callback only."
if not isinstance(rcpts, list):
rcpts = [rcpts]
for rcpt in rcpts:
self.logger.debug(f"delrcpt: {rcpt}")
self.msginfo["rcpts"].remove(rcpt)
super().delrcpt(rcpt)
def connect(self, IPname, family, hostaddr):
try:
if hostaddr is None:

View File

@@ -301,7 +301,8 @@ class Quarantine:
custom_logger = CustomLogger(
self.notification_logger, {"name": self.notification_name})
self.notification.execute(milter, pretend, custom_logger)
milter.msginfo["rcpts"] = []
milter.delrcpt(milter.msginfo["rcpts"].copy())
if self.milter_action is not None:
return (self.milter_action, self.reject_reason)