Getmail - Attachments

,

I’m not sure to understand what’s your problem.

Could you please post here your template-custom and the generated output file?

This is the Template

#
# 10junkmail
#
{
     if($dovecot{SpamFolder} ne '') {
        $OUT = <<EOF
# -- enabled (move marked SPAM messages into junkmail folder)
require ["fileinto", "mailbox"];
if header :contains "X-Spam-Flag" "YES" {
    fileinto :create "$dovecot{SpamFolder}";
    stop;
}
EOF
     } else {
        $OUT = "# -- disabled (Spam is delivered to INBOX)\n";
     }
}

End this is sieve file

#
# 10junkmail
#
# -- enabled (move marked SPAM messages into junkmail folder)
require ["fileinto", "mailbox"];
if header :contains "X-Spam-Flag" "YES" {
    fileinto :create "Junk";
    stop;
}

I am the original Sive in the template is not there and it gives error message, it is not what the script do, but how the template is to be created. I think this is the Orginalscript already a good comparison, right?

I already know the original template, I wrote it :slight_smile:
I need to see your modifications, if you need help :wink:

Please, remember that curly brackets must be escaped inside a template.

See also the developer manual if you already didn’t (http://docs.nethserver.org/projects/nethserver-devel/en/v7/templates.html)

1 Like

Ok this ist my simplescript:/etc/e-smith/templates-custom/var/lib/nethserver/sieve-scripts/before.sieve/40custom

{
$OUT .= 'require ["fileinto", "mime"];';
$OUT .= 'if header :mime :type "Content-Type" "image" {';
$OUT .= 'fileinto "Inbox.images";';
$OUT .= 'stop;';
$OUT .='}';
}

However, the filter does not attack :frowning:

The fragment seems correct, I don’t know if @davidep or @filippo_carletti have observation on the actual rule :slight_smile:

My bad, we have pigeonhole 0.4.2, but mime support was added in 0.4.10.
https://raw.githubusercontent.com/dovecot/pigeonhole/0.4.15/NEWS

Here’s the error:

# sievec /var/lib/nethserver/sieve-scripts/before.sieve
before: line 17: error: require command: unknown Sieve capability `mime'.
before: line 23: error: unknown tagged argument ':mime' for the header test (reported only once at first occurence).
before: error: validation failed.
sievec(root): Error: failed to compile sieve script '/var/lib/nethserver/sieve-scripts/before.sieve'

A workaround may involve using the body extension as explained here:
https://www.dovecot.org/list/dovecot/2014-February/094719.html

You may also try to use a newer dovecot version, rebuilding a fedora package (FC26 has pigeonhole 0.4.19 which is new enough).

Many thanks for the good tip
Why is on the current system a Dovecot Released v2.2.10. Mon Nov 25 02:28:21 EET 2013 installed, which is already relatively old, which is indeed Debian current :wink:

Red Hat / CentOS rarely use the latest version of a software. I think it’s all about stability.

Use here procmail to filter mails in the Nethserver? Where you have the .procmailrc filed, with an AD connection? How is it integrated in the postfix, simply by mailbox_command?

Is it possible to use a Pythonscript to use mimefilter? Maybe shevelib would be okay? At the moment I am using a Hmailserver which removes certain attachments from the mail (office documents) via VBS. These attachments are later attached to the mail in an encrypted ZIP file and the password is sent as an attachment in a text file. A click threshold should be reached, so that you don’t always have to click on every document right away. But in view of this, I would like to have everything on a mail system without having to install a system by hand.
Is there a possibility to call a script from Sieve, which works best with Python? This would also avoid Getmail, since the mail is only processed after delivery and this can be adjusted differently for the users.