cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1600
Views
0
Helpful
7
Replies

filter condition for "no attachment"

daro
Level 1
Level 1

Hello,
I need a condition for a filter that matches if there is NO attachment at all.

I have tried something like this, but that does not seem to work.

attachment-filename != "^.$"

any suggestions.

thanks
Cheers
Daniel

1 Accepted Solution

Accepted Solutions

Daniel,

The below message filter appears to work for me on the lab device.

Filter1:
if NOT(attachment-filename == ".")
{
log-entry("Attachment not Present");
}

- Libin V

View solution in original post

7 Replies 7

Libin Varghese
Cisco Employee
Cisco Employee

The regex you are currently testing with matches one character alone.

I would recommend using just "."

attachment-filename != "."

- Libin V

Hello Libin,
I tried with the suggested command, but that does not seem to work.

do you know any other simple way to get such a condition?

thanks
cheers
Daniel

Daniel,

The below message filter appears to work for me on the lab device.

Filter1:
if NOT(attachment-filename == ".")
{
log-entry("Attachment not Present");
}

- Libin V

thank you

NOT(attachment-filename ==".") works, but (attachment-filename != ".") does not work.
which means I have to use a message filter to get that result.

anyway, thank you for looking into this.

cheers
Daniel

If you prefer to keep your logic in your GUI as far as is possible then the message filter could just add a header and a subsequent content rule could pick up on the header.

Depending on the security implications for your application, you might need to invert the logic and flag "this mail has attachments" rather than "this mail has no attachments" which could lead to some rather contorted logic, or you might add a precautionary strip action.

I am using some other condition with those filters and I want to add different actions based on the fact if there is an attachment or not.

condition A + attachment
 = warning 1

condition A + no attachment
 = warning 2

in my case using skip-filter in combination with the correct order was not possible, so I wanted to have a direct condition that matches the fact "NO attachment"

Yes, to be absolutely safe you would want an apparently redundant strip-attachment (bytes > 0) action on the second rule in case some bright spark were to fake the proposed header.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: