Return Permanent Failure when dealing with undeliverable mail

This commit is contained in:
Piotr F. Mieszkowski 2024-09-21 14:10:29 +02:00
parent c1d9210c5e
commit 1a7c83d565
Signed by: pfm
GPG key ID: BDE5BC1FA5DC53D5

View file

@ -71,13 +71,17 @@ class MailEncryptionProxy:
else:
LOG.exception('Unexpected exception caught, bouncing message')
return xport.RESULT_TRANS_FAIL
return xport.RESULT_PERM_FAIL
return xport.RESULT_OK
def _send_unencrypted(self, operation, envelope: Envelope, send: xport.SendFrom):
# Do not parse and re-generate the message, just send it as it is.
send(envelope.original_content, operation.recipients())
try:
send(envelope.original_content, operation.recipients())
except:
LOG.exception('Unencrypted delivery failed, returning PERMANENT FAILURE to sender')
raise xport.PermanentFailure()
def _beginning(self, e: Envelope) -> bytes:
double_eol_pos = e.original_content.find(DOUBLE_EOL_BYTES)