Question on Mail forward based on attachements

Hi,

using Sogo it is simple to set up filters, e.g. to forward a mail from a specific sender to a specific mail box. In my case I would like to forward any email recived by

myself@mydomain.tld

to
mydmsserver@mydomain.tld

The filter case should be

Has attachment = yes AND
(Attachment type = “pdf” OR attachment name contains “.pdf” ) AND
(Attachment name contains “invoice” OR Attachment name contains “Rechnung” OR subject contains “invoice” OR subject contains “Rechnung”)

Sogo filters do not allow filtering based on attachments. Has anybody an idea how to setup such a filter based on attachments?

TIA
Thorsten

NethServer Version: 7.9
Module: email / sogo /

@thorsten

Hi Thorsten

I’m not sure, but AFAIK Mail-Sieve rules could handle it. These are processed directly by the mailserver (postfix) so even before SoGo sees the mail…

You can use Roundcube to set the server side mailsieve rules…

My 2 cents
Andy

1 Like

I’ve found the following:

Blocking certain filenames

You can use the “body” check with the extra keyword “:raw” to examine the “raw content” of a message, which lets you do things like block messages containing certain filenames (attachments).

We already block many malicious filetypes, but this example lets you also block all “.zip” and “.tgz” files:

require [“regex”, “body”, “fileinto”]; if body :raw :regex [“filename=.+\.zip”,“filename=.+\.tgz”] { fileinto “Trash”; }

Note that unlike our general filetype blocking, this kind of thing only catches top-level filenames, and can’t “look inside” a .zip file, for example.

3 Likes