Use sieve to move all mail automatically based on List-Id

2019-02-09 Thread Matthias Fechner via dovecot
Dear all,

I currently use the following rule to automatically sort email into
folders based on mailing lists:

# split out the various list forms
# Mailman & other lists using list-id
if exists "list-id" {
    if header :regex "list-id" "<([a-z_0-9-]+)[.@]" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
    } else {
    if header :regex "list-id" "^\\s*

it moves the email to the folder 142 as the regex matches inside the <> string 
till the none-letter/none-number/_/- is matching.
I do not understand the expresion [.@] so it is nearly impossible for my to 
extend that query.

What I would like to do is using the ID as folder name as fallback.
So in this case I would like that the email is moved to folder 
`mfechner/ci-test`.
I'm not sure if sieve can handle the `/` correctly.

Thanks a lot for any tip.

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook



Re: Using SHA256/512 for SQL based password

2019-02-12 Thread Matthias Fechner via dovecot
Am 12.02.2019 um 17:05 schrieb Robert Moskowitz via dovecot:
> I have trying to find how to set the dovecot-sql.conf for using
> SHA256/512.  I am going to start clean with the stronger format, not
> migrate from the old MD5.  It seems all I need is:

you maybe would like to have a look to the hashing algo ARGON2I which is
currently recommended for new developments and deployments.

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook



Re: Using SHA256/512 for SQL based password

2019-02-12 Thread Matthias Fechner via dovecot




Am 13. Februar 2019 00:34:15 schrieb Robert Moskowitz :


On 2/12/19 6:03 PM, Matthias Fechner via dovecot wrote:

Am 12.02.2019 um 17:05 schrieb Robert Moskowitz via dovecot:

I have trying to find how to set the dovecot-sql.conf for using
SHA256/512.  I am going to start clean with the stronger format, not
migrate from the old MD5.  It seems all I need is:

you maybe would like to have a look to the hashing algo ARGON2I which is
currently recommended for new developments and deployments.


Recommended by whom?

Can you provide a link?


Sure, please see here:
https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet




And if I was adventurous about hashes, I would be looking more at Keccak.


Check out my Internet Draft:


draft-moskowitz-small-crypto-00.txt


Thanks for the tip, will have a look for into it.

Gruß
Matthias





IMAPSieve message marked as HAM should go through full sieve script of user

2019-05-10 Thread Matthias Fechner via dovecot

Dear all,

I use the IMAPSieve implementation described here:
https://wiki.dovecot.org/HowTo/AntispamWithSieve

It is working really great! Thanks a lot for this.

The problem I have now is:
A message was by accident marked by rspamd as spam, so a false-positive 
and is moved to the Junk folder.
If I click in my email program now on `Not Spam` it is learn as HAM but 
moved to the INBOX.
I would like that the email is not moved to INBOX but it should be moved 
through the sieve script of the user again, as it is a new email.


Currently I have to mark all false-positives as not spam and have then 
to manually move it to the correct subfolder which is a bit annoying.


Is this possible?

Thanks a lot!


--
Gruß
Matthias


Re: Character not allowed in mailbox name

2019-07-22 Thread Matthias Fechner via dovecot
Am 22.07.2019 um 17:52 schrieb Timo Sirainen via dovecot:
> Accidental bug. Fixed
> by 
> https://github.com/dovecot/core/commit/62f3b738efd4a6444a4bde4a80bea208c5b39ccd

thanks a lot for this, that restored now all my installationd into a
working state, which were broken by 2.3.6 -> 2.3.7 upgrade.


Gruß
Matthias



Dovecot uses wrong separator after migration, modify sieve script

2025-02-11 Thread Matthias Fechner via dovecot

Dear all,

I migrated a dovecot installation that was using pam to a virtual setup 
where users are stored in a SQL database.


I see that my old pam based installation on the filesystem directories 
are starting with a dot.

The new server does not have the leading dot.

So even if the configuration is mostly equal, I cannot find a reason why 
dovecot changed its behavior here.
I do not define a separator in the dovecot configuration and the same 
dovecot package on FreeBSD is used for both installations.


My problem is now, that I use a rather complex sieve script to 
automatically sort mailinglist based emails automatically into subfolders.
But as this script is using a dot it is now not moving the email into a 
nested directory like:

github/haproxy/haproxy

but is generating a flat directory (depth 1) as
github.haproxy.haproxy

I cannot change the behavior of dovecot, as I have several users running 
there and I do not want to cause problem for them changing the dovecot 
configuration.


So I must modify the sieve script.
As I do not really know the sieve syntax, I would like to ask if 
hopefully someone here can help me.
I think is is necessary to change the dots to slashes before the 
fileinto is executed.


The sievescript I use to sort mailing based emails into subfolder is:
#
# 2016-5-2 Script to sort mailing list mails automatically to folders
#
##
require [ "regex", "include", "variables", "fileinto", "envelope", 
"mailbox", "imap4flags", "vnd.dovecot.debug" ];

global ["sender_userpart", "sender_domain", "listname"];

# split out the various list forms
# Mailman & other lists using list-id
if exists "list-id" {
  fileinto :create "${listname}";
  stop;
}
# Listar and mailman like
elsif exists "x-list-id" {
  debug_log "Mailinglist: x-list-id found";
  if header :regex "x-list-id" "<([a-z_0-9-]+)." {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
  } else {
    keep;
  }
  stop;
}
# Ezmlm
elsif exists "mailing-list" {
  debug_log "Mailinglist: mailing-list found";
  if header :regex "mailing-list" "([a-z_0-9-]+)@" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
  } else {
    keep;
  }
  stop;
}
# York lists service
elsif exists "x-mailing-list" {
  debug_log "Mailinglist: x-mailing-list found";
  if header :regex "x-mailing-list" "^s*([a-z_0-9-]+)@?" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
  } else {
    keep;
  }
  stop;
}
# Smartlist
elsif exists "x-loop" {
  debug_log "Mailinglist: x-loop found";
    if header :regex "x-loop" "^s*(a-z_0-9-]+)@?" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
    } else {
    keep;
    }
    stop;}
# poorly identified
elsif envelope :contains "from" "owner-" {
  debug_log "Mailinglist: poorly identified matched";
    if envelope :regex "from" "owner-([a-z_0-9-]+)-outgoing@" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
    } elsif envelope :regex "from" "owner-([a-z_0-9-]+)@" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
    } elsif header :regex "Sender" "owner-([a-z_0-9-]+)@" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
    } else {
    keep;
    }
    stop;}
# other poorly identified
elsif  envelope :contains "from" "-request" {
    if envelope :regex "from" "([a-z_0-9-]+)-request@" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
    } else {
    keep;
    }
    stop;
}

Thanks a lot!

Gruß
Matthias

--

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Sieve fails to find existing folder?

2025-04-22 Thread Matthias Fechner via dovecot

Am 23.04.2025 um 07:34 schrieb Alexander Skwar via dovecot:

if anyof (address :regex :comparator "i;octet" "from" "@(swisscom\\.com|skwar\\.me|5y5\\.one)$", 
address :contains "from""alexande...@bluewin.ch")
{
addflag "$label3";
fileinto "INBOX/🫥 Privat";
}

It works fine — an email fromalexande...@bluewin.ch was filed into "INBOX/🫥 
Privat".

/var/vmail/sieve/a...@skwar.xyz.sieve.log contains:

sieve: info: started log at 2025-04-22 21:34:53 +0200.
error: msgid=<890352f2-9eab-4574-a871-a56e19d47...@facebookmail.com>: fileinto 
action: failed to store into mailbox 'INBOX/🫥 Privat/🦸🏼‍♀ Cassandra': Mailbox doesn't 
exist: INBOX/🫥 Privat/🦸🏼‍♀ Cassandra.


maybe use:
fileinto :create "${listname}";

and check what happens?

Gruß
Matthias

--

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org