Re: imapsieve and master user

2021-04-06 Thread André Rodier
On Wed, 2021-04-07 at 02:13 +0200, Stephan Bosch wrote:
> 
> On 04/04/2021 22:19, André Rodier wrote:
> > Hello all,
> > 
> > I have am imap sieve script, running fine.
> > 
> > I would like to check, if it is possible, inside the sieve script,
> > if
> > the current user is a master user or not.
> > I believe this is probably not possible.
> > 
> > Otherwise, if it is not possible, I would like to check for an
> > external
> > condition, like an existing file in /tmp or in the mail dir folder,
> > for
> > instance.
> > 
> > The issue is that I want my imap sieve script behave differently if
> > the
> > master user is connected.
> > 
> > Thanks for any piece of advice.
> 
> Maybe you could fudge something by adding a sieve_env_ field to
> master 
> user's userdb lookup and configuring the vnd.dovecot.environment
> extension:
> 
> https://github.com/dovecot/pigeonhole/blob/master/doc/extensions/vnd.dovecot.environment.txt
> https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-dovecot-environment.txt

Thanks, Stephan,

I ended up using another method. The goal was to prevent email clients
to copy emails in the Sent folder, but still allow import emails
procedure to append emails using the APPEND verb in this folder.

I used sieve include, and added "keep;stop" in the included file during
the import procedure.

However, thanks to you, I know know what is possible.

Kind regards,
André

> 
> > Kind regards,
> > André Rodier
> > 



Re: imapsieve and master user

2021-04-06 Thread Stephan Bosch




On 04/04/2021 22:19, André Rodier wrote:

Hello all,

I have am imap sieve script, running fine.

I would like to check, if it is possible, inside the sieve script, if
the current user is a master user or not.
I believe this is probably not possible.

Otherwise, if it is not possible, I would like to check for an external
condition, like an existing file in /tmp or in the mail dir folder, for
instance.

The issue is that I want my imap sieve script behave differently if the
master user is connected.

Thanks for any piece of advice.


Maybe you could fudge something by adding a sieve_env_ field to master 
user's userdb lookup and configuring the vnd.dovecot.environment extension:


https://github.com/dovecot/pigeonhole/blob/master/doc/extensions/vnd.dovecot.environment.txt
https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-dovecot-environment.txt


Kind regards,
André Rodier





Re: [Sieve] Understand Sieve processing

2021-04-06 Thread Stephan Bosch




On 26/03/2021 08:30, h8h wrote:

Hi,

I have the following configuration:


cat > /etc/dovecot/conf.d/99-local-sieve.conf << EOF;
plugin {
 sieve_before = /etc/dovecot/sieve-spam.sieve
 sieve_before2 = /mail/sieve/global_before
 sieve_after = /mail/sieve/global_after
 sieve = /mail/sieve/%d/%n.sieve
 sieve_dir = /mail/sieve/%d/%n
}
EOF



cat /etc/dovecot/sieve-spam.sieve
require ["regex", "fileinto", "imap4flags"];

if allof (header :regex "X-Spam-Status" "^Yes") {
 fileinto "Spam";
}


(I removed the keyword "stop;" to proceed rule processing, which does 
not work)



Now as a user (/mail/sieve/%d/%n.sieve) I want to create my own "Spam" 
rule:

require ["regex","reject"];
# rule:[SPAM]
if allof (header :regex "x-spam-status" "^Yes")
{
   reject text:
This E-Mail is SPAM.
.
;
}




I activate the traces and see the following if the e-mail is SPAM:


 ## Started executing script 'sieve-spam'
  3: jump if result is false
  3:   not jumping
  4: fileinto action
  4:   store message in mailbox `Spam'
 ## Finished executing script 'sieve-spam'



If the e-mail is not SPAM:

 ## Started executing script 'sieve-spam'
  3: jump if result is false
  3:   jumping to line 4
 ## Finished executing script 'sieve-spam'


 ## Started executing script 'roundcube'
  3: jump if result is false
  3:   jumping to line 10
 ## Finished executing script 'roundcube'


So my sieve gets only executed if the e-mail is not SPAM. Thats a bit 
odd.


Could you explain how the sieve processing work and how I can solve 
this problem?


The fileinto action cancels the implicit keep 
(https://tools.ietf.org/html/rfc5228#section-2.10.2). There is no 
explicit action in sieve-spam either, so Sieve execution ends there:


https://tools.ietf.org/html/draft-degener-sieve-multiscript-00

Regards,

Stephan.


Re: Emails to multiple recipients on same server not getting delivered

2021-04-06 Thread Linda A. Walsh

On 2021/04/05 12:27, John Stoffel wrote:

I suspect you're only delivering to the first recipient, in the email,
and not calling the delivery for each and every local recipient
individually.
  

--
I'll 2nd that, as from what you've said, you took the mailer
that handles distribution of each copy of the email to
all and multiple recipients out of the equation.