Bounce Classification

Hello

I want to reclassify bounce, for example, at present Spam (PolicyRelated) will directly become Bounce, and I want to make it TransientFailure so that I can have time to deal with complaints.

So I think have 2 ways .

  1. use :smtp_client_rewrite_delivery_status ; But this method need write lua code(I like helper)
  2. self config bounces.toml

The second way , init.lua config

kumo.configure_bounce_classifier {
    files = {
      ‘/opt/kumomta/etc/policy/bounces.toml’
    },
  }

it can work?

I just test
In bounce file , i write 2 rules

"Mailbox unavailable or access denied", # 58.com , qq.com
  "^550.+Mailbox unavailable or access denied", # qq.com

but I see ELK Log , the type also be “Bounce” ..
error log

"response": {
      "code": 550,
      "content": "Mailbox unavailable or access denied [MLc/szh2cqGXdSR2rPMidGuO+ooKqJNsRaxxPGar8Ao3TLD7ESCndszWb+Mgqd5MTQ==  IP: xxxx]. https://service.mail.sss.com/detail/0/166.",
      "command": ".\r\n"
    },
"type": [
      "Bounce"
    ],

Maybe I should add * behind Mailbox unavailable or access denied?

"Mailbox unavailable or access denied*", 
"^550.+Mailbox unavailable or access denied*",

What is your desired outcome?

Mailbox unavailable or access denied should be TransientFailure

See Rewriting Remote Server Responses - KumoMTA Docs

OK, Thanks .It means that I can only use the first scheme mentioned at the beginning to write lua implementation. Why can’t bounces.toml be implemented? Is it my misunderstanding of this scheme. I’m just trying to deepwiki the solutions offered

But I feel that maintaining a set of lua code and bounce.toml the same configuration, I really want’s write 2 configs .. it’s not worth it.

The bounces.toml is for classifying bounces. You don’t want to classify those bounces, you want to rewrite them. That’s a different task and therefore a different configuration.

OK… if I write from smtp_client_rewrite_delivery_status , enhanced_code should be used? in dsn_rewrite.json it will be ?

"5\\.7\\.1 Mailbox unavailable or access denied" : 400

I haven’t tested it but that looks like it will work.

I will say to be careful with that. It’s one thing to rewrite temporary failures into permanent, but rewriting permanent failures into temporary ones can be considered malicious by some mailbox providers since they are telling you to stop trying to send a message and you’re ignoring them.

Yes, thanks for the reminder. We used Momentum before. it made a Block or SoftBounce when Spam message , which is give time for us to appeal for ISP . But after we migrated to kumomta, Bounce was identified as Hardbounce, which caused our Hard ratio to be abnormally high. This is also the reason for this change.