cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
162
Views
0
Helpful
1
Replies

Custom Bounce Message II

Steflstefan
Level 1
Level 1

Hello @All,

This question has been asked before. However, the proposed solution does not seem to work.
https://community.cisco.com/t5/email-security/custom-bounce-message/td-p/5136251

If the "bounce()" action is triggered via a message filter, this text appears in the bounce message by default:
"554 5.0.0 < #5.0.0 smtp; 5.x.0 - Message bounced by administrator (delivery attempts: 0)>"

How can I customize the text? For example:
'554 5.0.0 < #5.0.0 smtp; 5.x.0 - Message bounced by policy violation, policy #123>'

I tried the following:
* Created a bounce notification text resource "CustomBounce"
* Created a bounce profile "CustomBounce" and selected the text resource "CustomBounce" as the notification template.
* Created a message filter with the actions "bounce-profile("CustomBounce");" and "bounce();"

I still get the default notification, not the text from the "CustomBounce" template.

How can I ensure that bounce actions in message filters do not output the default text in the bounce, but rather a customized, meaningful message?

Thanks
Stefan

1 Reply 1

wajidhassan
Level 4
Level 4

It turns out this is a known issue with AsyncOS message filters: bounce-profile() + bounce() in filters doesn’t correctly apply your custom bounce text—it silently falls back to the default template .

Workaround: Use notify() Instead of bounce()
While bounce() can't apply a custom message when used in filters, you can replicate similar behavior with a combination of notify() and a message filter:

Add a custom header or tag in your filter:

apache
Copy
Edit
if (<your filter condition>) {
insert-header('X-Custom-Bounce', 'policy #123 violation');
notify('$EnvelopeFrom', '550 5.0.0 - Message bounced by policy violation, policy #123', '');
drop();
}
notify() lets you specify the exact SMTP code and message.

drop() prevents further processing, effectively acting like a bounce.

Alternatively, set an alternate delivery route:

apache
Copy
Edit
if (<condition>) {
insert-header('X-Custom-Bounce', 'policy #123 violation');
notify('$EnvelopeFrom', '554 5.0.0 - Message bounced by policy violation, policy #123', '');
drop();
}
You can also instruct your notify() to include the message body or headers per your needs.

This effectively replicates a bounce, providing full control over the bounce text.

Why It Works
notify() generates a DSN-style SMTP notification, and allows custom content, unlike bounce() in message filters.

Combined with drop(), the original message is discarded without delivery.

Summary Table
Action Needed What & Why
Use notify() Enables custom SMTP response text.
Insert header (Optional) Tag filter-triggered bounces for logging.
Use drop() Stops further processing — simulates a hard bounce.