1

Topic: Block attachments with exceptions

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version: 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MARIADB
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
====
I intend to block/redirect the reception of all e-mails that have an attachment with the extension .doc, except those coming from a certain list of domains / addresses.
What is the best way to do this?

I appreciate your help.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Block attachments with exceptions

You may find solution here:
http://verchick.com/mecham/public_html/ … ssing.html

3

Re: Block attachments with exceptions

ZhangHuangbin wrote:

You may find solution here:
http://verchick.com/mecham/public_html/ … ssing.html

Thanks for your help. I tried to use header_check and managed to be part of what I wanted, which was to block all messages with .doc extension. What is missing is the possibility of defining a rule to authorize the addresses of a given domain? Is it possible to be done this way? 
I appreciate your help.

/from.*domain-A.*/ OK   <-- This is the problem

/name=[^>]*\.(docx)/ OK
/name=[^>]*\.(doc|vbs)/ DISCARD

4 (edited by ACosta 2020-10-26 18:21:21)

Re: Block attachments with exceptions

I share the solution found, based on a sieve script.
source:
https://www.fastmail.com/help/technical … howto.html
https://support.tigertech.net/sieve

require ["regex", "body", "fileinto"];
(…)
#Sends email with blocked attachments .doc for analysis, allows attachments from the white list
# rule:[block attachments]
if body :raw :regex ["filename=.+\\.doc\""]
{
  if not anyof( address :domain "From" "domainA.aa" ,
                     address :domain "From" "domainB.bb" ,
                  (...)
                     address :domain "From" "domainX.xx" )
  {
  if  not address :is "Delivered-To" "review@myemail.aa"
    {
    redirect "review@myemail.aa";
    }
  }
}

5

Re: Block attachments with exceptions

Thanks for sharing.