[Dovecot] dbus support in dovecot?

Ben Morrow ben at morrow.me.uk
Thu Jul 25 17:03:39 EEST 2013


At  9AM -0400 on 25/07/13 you (Gene Heskett) wrote:
> On Thursday 25 July 2013 08:38:33 Steffen Kaiser did opine:
> 
> > there might be a misunderstanding here, Dovecot is an IMAP and POP3
> > server. It ships tools that replicate messages from other Dovecot
> > servers and in limits from other IMAP servers.
> > 
> > If you intend to POP other servers, copy their messages to one local
> > host and view your messages "offline", I would keep fetchmail and Co.
> 
> That is the gist of what I have in mind.
> 
> Dovecot can I assume, watch the mailfiles in /var/spool/mail?
> 
> My present method of using inotifywait wrapped in a bash script to tell 
> kmail to go get the new mail via a dbus message has worked well for years.  
> But with no previous experience with imap, I haven't a clue how new mail 
> arrival is handled in that sort of a setup.

If a mail client (kmail or anything else which supports IDLE) has a
logged-in IMAP session which is sitting in IDLE, Dovecot will watch that
user's mailspool and notify the client when new mail arrives.

What it won't do, however, is try to take that new mail out of the
spool, filter it, and put it back. If you want Dovecot to filter mail
you have to insert it into the delivery chain, before the mail gets to
/var/spool/mail. There are two ways of doing this: with dovecot-lda, or
with LMTP.

> > Or when it suits more, maybe imapsync. If you keep that chain any local
> > mailer should be able to pick up the locally spooled messages. Maybe
> > you could switch to Maildir as backend, in order to minimizes locking
> > issues. Of course, you could serve that local mail spool with Dovecot
> > to other IMAP or POP3 clients.
> 
> Already "pigeonhole"d or "sieve"d into the usual folder format?  Once I get 
> the sorting filter rules re manufactured, that would be great!

It sounds to me like you *just* want dovecot-lda. dovecot-lda is an MDA,
that is, a program which does the same job as procmail or maildrop, and
it supports Sieve. It also supports sieve extensions which let you run
arbitrary programs, so you can run the mail through clamav/whatever.

If you configure Dovecot to keep mail in /var/spool/mail, and to use
sieve, and then replace your current call to procmail with an equivalent
call to dovecot-lda, I believe this will do what you want. I'm not sure,
but I think with Dovecot 2 you will need to run the basic Dovecot
daemons in order to make things work, but you can turn off IMAP and POP.

Of course, once you've got delivery working you could then turn IMAP
back on, and get rid of that inotifywait hack. At that point there's no
good reason to stick to an mbox format mailspool, since the only program
which ever touches it is Dovecot, so you can switch to Maildir or dbox
instead. However, I would strongly recommend changing only one thing at
a time, and making sure the new setup works properly before changing
anything else.

> > You also could fetchmail the remote hosts and inject them into a local
> > Dovecot server via LMTP, you can then try to run clamav and spamd from
> > Sieve and you have the other Sieve-capabilities as well.
> 
> LTMP is a new acronym to me.  Sorry. Synonymous to an MTA?  Effectively 
> replacing procmail with dovecot and sieve but still using spamd and clamav?

You mean MDA. An MTA (Mail Transfer Agent) receives mail by SMTP and
either hands it to an MDA or sends it out again by SMTP; an MDA takes
mail from an MTA and does local delivery.

LMTP is a protocol for MTAs to talk to MDAs; that is, instead of the MTA
invoking the MDA with command-line arguments and passing the message on
stdin, it opens a socket (usually Unix-domain) and talks to the MDA on
the other end. (The protocol itself is very nearly the same as SMTP,
with one rather important difference.)

Using LMTP rather than a command-line MDA means the MDA runs as a
daemon, and the MTA has to be configured to use an LMTP client rather
than a command for delivery. As far as Dovecot is concerned this is
pretty-much the only important difference.

Ben



More information about the dovecot mailing list