Re: Question about sieve language

2024-03-15 Thread Tom Hendrikx via dovecot




On 14-03-2024 12:51, Ralph Seichter via dovecot wrote:

* Tom Hendrikx via dovecot:


Or in readable sieve: [...]


Do you mean to imply that regular expressions are not readable? ;-) All
it takes is a little practice. Besides, regex are more efficient. It is
well worth learning about them, and regex are really not as bad as some
make them out to be.



In general, I think regular expressions are fine, but less readable than 
simple statements (I'm well versed in regex).


The one thing that made me fall in love with sieve is the fact that the 
syntax is so wonderfully clear and self-documenting, almost readable as 
normal language. I never need to add comments to a sieve script 
explaining to my future self what a specific rule tries to achieve.


And given the amount of work that a sieve script does, I don't think 
that optimization is something you should strive for, when you have to 
trade it for readability and clarity.


Just my preference :)

Kind regards,
Tom
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Question about sieve language

2024-03-13 Thread Tom Hendrikx via dovecot




On 13-03-2024 17:36, Ralph Seichter via dovecot wrote:

* Lev Serebryakov:


I need to match all messages sent from some specific domain and all
its sub-domains.


I prefer using regular expressions for this kind of tests:

   if address :regex "From" "[@.]example\.(com|org)$" {...}

This will match all addresses for example.com, example.org and their
respective subdomains.



Or in readable sieve:

if anyof (
address :domain :is "From" "example.org",
address :domain :contains "From" ".example.org"
) { keep; }

Which might match "subdomain.example.org.gotcha.com", but how often 
would that happen?


Kind regards,

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


Abort IMAP COPY command from imapsieve?

2024-03-11 Thread Tom Hendrikx via dovecot

Hi,


I'm finding myself regularly moving messages to the wrong folder in my 
MUA. Most of the time this is easily corrected, but sometimes this is a 
bit harder. Imagine selecting all messages in the 'Trash' or 'Junk' 
folder, and moving them in the 'Archive' folder (by clicking on the 
MUA's 'Archive' button in stead of the 'Delete' button).


I'm looking into blocking this server-side using an IMAPSieve script. So 
far I've been able to log relevant details of such a message move, but I 
don't how I can abort the message move altogether. I'm now using the 
following config, which result in log messages like:


dovecot: 
imap(t...@example.org)<540588>: sieve: 
DEBUG: move-to-archive: Message archived: mailbox-from=INBOX 
mailbox-to=Archives.2023 
message-id=<648ab0b4-8439-4b2d-8e53-b97e700ff...@mail.example.org> 
subject='Testing IMAPSieve'


File: dovecot.conf
-
protocol imap {
  mail_plugins = $mail_plugins imap_sieve
}

plugin {
  sieve_plugins = sieve_imapsieve
  sieve_implicit_extensions = +vnd.dovecot.debug

  # Find out how to block messages from being from 'Trash' to 'Archive' 
folder

  imapsieve_mailbox1_name = Archives.*
  #imapsieve_mailbox1_from = INBOX
  imapsieve_mailbox1_before = 
file:/etc/dovecot/sieve-scripts/move-to-archive.sieve

}
-

File: move-to-archive.sieve
-
require "environment";
require "variables";
require "vnd.dovecot.debug";
require "vnd.dovecot.imapsieve";

if header :matches "Message-ID" "*" {
set "message_id" "${1}";
} else {
set "message_id" "UNKNOWN";
}

if header :matches "Subject" "*" {
set "subject" "${1}";
} else {
set "subject" "UNKNOWN";
}

if environment :matches "vnd.dovecot.mailbox-from" "*" {
set "mailbox_from" "${1}";
} else {
set "mailbox_from" "UNKNOWN";
}

if environment :matches "vnd.dovecot.mailbox-to" "*" {
set "mailbox_to" "${1}";
} else {
set "mailbox_to" "UNKNOWN";
}

debug_log "move-to-archive: Message archived: 
mailbox-from=${mailbox_from} mailbox-to=${mailbox_to} 
message-id=${message_id} subject='${subject}'";

-

I tried the "reject" sieve command but that only works in the context of 
delivery. Is there a way to abort the actual move, and return an error 
to the MUA? Or am I on the wrong track altogether, and is there a better 
approach?



NB: While doing research I found that not all environment variables in 
RFC 6785 (https://www.rfc-editor.org/rfc/rfc6785.html#section-4) are 
implemented in Pigeonhole? I tried to access the 'imap.cause' and 
'imap.mailbox' variables but they were empty, only the variables from 
RFC 5183 seem to be available. This is inline with the docs at 
https://github.com/dovecot/pigeonhole/blob/main/README, but not with 
https://github.com/dovecot/pigeonhole/blob/main/doc/plugins/imapsieve.txt 
and 
https://doc.dovecot.org/configuration_manual/sieve/plugins/imapsieve/, 
which both seems to imply that RFC 6785 is implemented?


Kind regards,

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


Re: User-configurable time-based mail deletion in specific folders

2024-03-11 Thread Tom Hendrikx via dovecot

Hi,

A bit late to the party, but I just ran into some docs that say that 
protonmail has a sieve extension that supports this: 
https://proton.me/support/sieve-advanced-custom-filters#managing-expiration. 
I'm not finding any source code though...


Kind regards,

Tom

On 25-02-2024 17:14, Aki Tuomi via dovecot wrote:

Hi!
  
You could return from userdb namespace/foo/mailbox/bar/autoexpunge=15d
  
to set per-user per-mailbox retention policies.
  
Aki

  On 25/02/2024 10:38 EET Rupert Gallagher via dovecot
   wrote:
   
   
   Things like this should be done locally on the Mailclient

   (MUA), IMHO.
   
  If you are a company, then you must delete old e-mails automatically,

  by GDPR law.
   
   Original Message 

  On Feb 21, 2024, 23:25, Steven Varco < dovecot@bbs.varco.ch>
  wrote:
   
   Am 21.02.2024 um 21:25 schrieb Peter Reinhold : > > Hi > I

   have been wondering about if Dovecot has a feature that
   would allow users to > setup a rule for a given folder,
   that mails older than X days should be > deleted? > Or is >
   this something that would need to be done by an external
   script? Yes. It goes beyond of what I expect from an IMAP
   server. > I have looked a bit at autoexpunge, and while the
   basic feature looks to be > what I need, it doesn't seem to
   be configurable down to a specific folder on a > single
   user. Things like this should be done locally on the
   Mailclient (MUA), IMHO. Steven -- https://steven.varco.ch/
   https://www.tech-island.com/
   ___ dovecot
   mailing list -- dovecot@dovecot.org To unsubscribe send an
   email to dovecot-le...@dovecot.org
   Things like this should be done locally on the Mailclient
   (MUA), IMHO.
   
  If you are a company, then you must delete old e-mails automatically,

  by GDPR
  law.
   
   
   
   Original Message 

  On Feb 21, 2024, 23:25, Steven Varco < dovecot@bbs.varco.ch>
  wrote:
   
   Am 21.02.2024 um 21:25 schrieb Peter Reinhold : > > Hi > I

   have been
  wondering about if Dovecot has a feature that would allow users to >
  setup a
  rule for a given folder, that mails older than X days should be >
  deleted? > Or
  is > this something that would need to be done by an external script?
  Yes. It
  goes beyond of what I expect from an IMAP server. > I have looked a
  bit at
  autoexpunge, and while the basic feature looks to be > what I need,
  it doesn't
  seem to be configurable down to a specific folder on a > single user.
  Things
  like this should be done locally on the Mailclient (MUA), IMHO.
  Steven -
  - https://steven.varco.ch/ https://www.tech-island.com/
  ___ dovecot mailing list
  -
  - dovecot@dovecot.org To unsubscribe send an email to dovecot-
  le...@dovecot.org
   
  ___

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

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


Re: A bug and a misleading description

2024-01-01 Thread Tom Hendrikx via dovecot



On 01-01-2024 13:53, David Van Edwards wrote:

!. I have just tried deleting Sent messages and when I put the search string 
1:200 in only one message was deleted. And when I put in 1:500 again only one 
message was deleted. In both cases a green message box came up saying the 
operation was successful.

2. I successfully deleted 1000 messages from my Inbox using the search string 
1:1000 but it was not clear to me that this would delete the 1000 most RECENT 
emails, not as I imagined the FIRST 1000 emails counting from the beginning. Is 
that the case? It certainly seems to have been the result and it’s rather 
upsetting.

Should your documentation make it clear whether 1:1000 is counting forwards or 
backwards?



Hi David,

Dovecot is a server application, it doesn't display a 'green message 
box' or something like that. This is probably your mail client 
acknowledging that it did what you asked from it. That might not 
necessarily be the same as you expected it to do: I've never seen a mail 
client that allows you to send an IMAP DELETE command with a 1:200 range 
from the GUI.


Maybe you should describe in detail:

- What mail client you are using to perform tests, and how you executed 
them.

- On which documentation you based your search strings.
- What version of Dovecot you are using, and maybe the output of 
'doveconf-n'

- What Dovecot logged when you performed your tests.

When logging is unclear or sparse, maybe enable mail_debug before you 
start the test to get more detail. See 
https://doc.dovecot.org/admin_manual/debugging/mail_debugging/


Probably I don't know the answer to your questions, but giving explicit 
information might help others to help you :)


Kind regards,
Tom
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: dovecot username with domain

2023-09-23 Thread Tom Hendrikx via dovecot

On 19-09-2023 22:36, Dave McGuire wrote:

On 9/19/23 16:34, Michael Grant wrote:


Thanks, I was hoping for something less complicated.  I found
   auth_username_format %n
which drops the domain if supplied.  Unfortunately my imap username
isn't 'mgrant'.  Probably i could make this work if there was no other
way.  This forces me to have my IMAP password the same as my unix
password.

I probably should move to virtual users for everyone on my box but
that's not so easy.  I was hoping there was some way i could translate
individual users which would make this transition easier.


You could have virtual users with any username (matching the required 
format for 'New Outlook') and password in an SQL passdb + userdb, and a 
second backend for the system users (PAM probably) as a fallback.


The docs describe this precise scenario at: 
https://doc.dovecot.org/configuration_manual/authentication/multiple_authentication_databases/



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


Re: dovecot username with domain

2023-09-19 Thread Tom Hendrikx via dovecot

On 19-09-2023 22:36, Dave McGuire wrote:

On 9/19/23 16:34, Michael Grant wrote:


Thanks, I was hoping for something less complicated.  I found
   auth_username_format %n
which drops the domain if supplied.  Unfortunately my imap username
isn't 'mgrant'.  Probably i could make this work if there was no other
way.  This forces me to have my IMAP password the same as my unix
password.

I probably should move to virtual users for everyone on my box but
that's not so easy.  I was hoping there was some way i could translate
individual users which would make this transition easier.


You could have virtual users with any username (matching the required 
format for 'New Outlook') and password in an SQL passdb + userdb, and a 
second backend for the system users (PAM probably) as a fallback.


The docs describe this precise scenario at: 
https://doc.dovecot.org/configuration_manual/authentication/multiple_authentication_databases/



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


Documentation issue: incorrect link

2023-05-05 Thread Tom Hendrikx via dovecot

Hello,

In the second paragraph at 
https://doc.dovecot.org/configuration_manual/sieve/extensions/duplicate/, 
a link is included to RFC7353, but this RFC is not related to sieve at 
all. I think the correct RFC to link is RFC7352, like in the first 
paragraph.


Kind regards,
Tom
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: dovecot sasl with postfix, smtp auth not available

2023-04-23 Thread Tom Hendrikx via dovecot

Hi,

There is also a feature in postfix where AUTH is only advertised over 
TLS (i.e. port 465, or port 25/587 after STARTTLS).


https://www.postfix.org/postconf.5.html#smtpd_tls_auth_only

On 23-04-2023 14:41, Badli Al Rashid wrote:

 > logs
No logs as I have to redo a new setup.

 > bound to fail
I was only trying to check if the smtp-auth is advertise by doing ehlo.

 > where is this change ?
My client ip was listed in sorbs.net. I could not connect to the smtp 
server.


 > how do you know its postfix ?
Because i did an apt install postfix on the node. dovecot is on the same 
node.


Regards,
-badli


*From:* Benny Pedersen 
*Sent:* Sunday, April 23, 2023, 20:22
*To:* dovecot@dovecot.org 
*Subject:* Re: dovecot sasl with postfix, smtp auth not available

Badli Al Rashid skrev den 2023-04-23 13:06:


My apologies, i am not using dovecot for submission server using
postfix with dovecot-sasl.


then post doveconf -n that shows it


I was not able to authenticate if I use a webmail when testing using
username to authenticate with smtp connection it fails.


logs


I could authenticate normally using port 465 / 587 but it is block at
the moment.


where is this change ?


When checking there was no smtp-auth on the smtp listed. I tried to
enable it on postfix
smtp_sasl_auth_enable, but it is was not advertise.

# telnet 127.0.0.1 25


bound to fail


Should the smtp be advertise with smtp-auth when dovecot-sasl is
enable on the postfix ?


how do you know its postfix ?

to help more its esitiential to know witch part failing

random questions gives random answers

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


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

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


Re: [Sieve] Multiple email recipients, how?

2019-11-24 Thread Tom Hendrikx via dovecot




On 23-11-19 18:40, Ralph Seichter via dovecot wrote:

* Tom Hendrikx via dovecot:


There are nice tricks you can do with virtual alias maps and pcre
within postfix to split email to specific user accounts, which could
also accommodate other alias schemes than standard subaddressing (such
as yours).


Postfix supports sub-addressing out of the box, simply by setting the
"recipient_delimiter" configuration parameter[1].

-Ralph

[1] http://www.postfix.org/postconf.5.html#recipient_delimiter

Standard subaddressing is not able to support the addressing scheme the 
OP has in place. But there are other ways, such as pcre alias maps, that 
will solve his problem a lot easier than Sieve address parsing, without 
discarding the existing (albeit peculiar) subaddressing scheme. I just 
wanted to make sure that the OP was aware of this.


Kind regards,
Tom


Re: [Sieve] Multiple email recipients, how?

2019-11-23 Thread Tom Hendrikx via dovecot




On 22-11-19 22:48, Ralph Seichter via dovecot wrote:

* Robert via dovecot:


We use a simple system for routing emails to different email users by
postfixing the addresses with the actual user: xxxJohn@domain;
yyyJohn@domain etc all will be delivered to user John.
(This way John can invent a new email address on-the-fly and that will
be delivered to his email box.)


This seems like a strange way achieve flexible email addresses. Are you
aware of sub-addressing? It has been around for ages, and is supported
by Dovecot (and Gmail, incidentally).

Imagine an existing email account . If alice wants to
use a subadress, she signs up with , and Dovecot
can automatically place incoming mail for that address into INBOX/foo
(or just INBOX if INBOX/foo does not exist). Alice can use as many
sub-adresses as she needs without anybody making config changes.

Frankly, the Sieve-based approach you describe seems pretty complicated
in comparison.



From the OP it seems that they separate mail for different users not at 
the MTA level, but at at the user level using sieve. That seems very 
inefficient to me.


There are nice tricks you can do with virtual alias maps and pcre within 
postfix to split email to specific user accounts, which could also 
accommodate other alias schemes than standard subaddressing (such as yours).


Kind regards,
Tom