Sieve: reject certain mime-types and notify recipient

Ralf Becker rb at egroupware.org
Mon Jan 14 21:22:58 EET 2019


I have to reject office files for a certain domain plus notifying the
original recipient about the rejection too.

require ["fileinto","reject","body","enotify","variables"];

if allof (address :contains ["To","TO","Cc","CC"] "@example.org", body
:content  "application/msword" :contains "") {
        set "to" "${1}";
        # :matches is used to get the value of the Subject header
        if header :matches "Subject" "*" {
                set "subject" "${1}";
        }
        # :matches is used to get the value of the From header
        if header :matches "From" "*" {
                set "from" "${1}";
        }
        notify :message "Rejected Office Datei ${from}: ${subject}" "${to}";
        reject text:
Aus Sicherheitsgründen nehmen wir keine Office Dateien mehr an. Bitte
senden Sie uns ein PDF.
.
;
}

A manual sievec call gives not error and if I remove everything but the
reject line it works.

Any ideas?

-- 

Ralf Becker
EGroupware GmbH [www.egroupware.org]
Handelsregister HRB Kaiserslautern 3587
Geschäftsführer Birgit und Ralf Becker
Leibnizstr. 17, 67663 Kaiserslautern, Germany
Telefon +49 631 31657-0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://dovecot.org/pipermail/dovecot/attachments/20190114/b945b47c/attachment.sig>


More information about the dovecot mailing list