[Dovecot] Simulating UW Snarf...

Geo Carncross geocar-dovecot at internetconnection.net
Fri Feb 10 19:57:40 EET 2006


On Thu, 2006-02-09 at 16:31 -0500, Todd Piket wrote:
> This means there will never be a situation where something is hopelessly 
> trying to deliver email to a user who never checks it (this does happen 
> here).  That is just a waste of processing time, IMHO.  This way it just 
> sits there taking up space until the user goes under quota or our 60-day 
> old mail cleaner removes it.

Your cleaner might then simply remove entries after mess/H is over 60
days old.

touch -d '60 days ago' /tmp/sentinel
(cd /var/qmail/queue/mess && find . -type f \! -newer /tmp/sentinel ) |
awk '{ print "touch -c -d '60 days ago' /var/qmail/queue/info/"$0 }' |
sh

This would bounce the messages, so I might avoid this by writing a small
script to actually remove the messages from the queue safely:

#!  /bin/sh
M="$1"
set -e
printf "F\0\0" > "/var/qmail/queue/intd/$M.tmp"
mv "/var/qmail/queue/intd/$M.tmp" "/var/qmail/queue/local/$M"
touch -c -d "60 days ago" /var/qmail/queue/info/$M"

This would, of course cause the message to be bounced to a null return
path (doublebounced).

If your nonquota files are [currently] mboxes, your 60-day old mail
cleaner must be extremely complicated.


> Again, IMO, having Dovecot handle the check is the more elegant solution.

Elegant?

I'm sorry, I use UNIX, where having three-four straightforward shell
scripts beats one block of a hundred lines of C any day. The correctness
is also much easier to verify.

Oh, and it doesn't tie you to a particular IMAP server, so that if
Dovecot doesn't work out in your testing, and you know that whatever
problems you had with UW you still have, you can investigate other
options.

But, if you REALLY want to do it your way, you can probably use the
convert plugin in the manner that Timo suggests...

> Geo Carncross wrote:
> > On Wed, 2006-02-08 at 22:18 +0100, Lorens wrote:
> >>> We 
> >>> need to never bounce mail yet deliver the mail that has built up for an 
> >>> over quota user as quickly as we can once that user goes below quota. 
> >>> If Dovecot moved the mail from /var/spool/mail/%u to the user's homedir 
> >>> then that is exactly what I want.  As long as it fails gracefully if the 
> >>> user is over quota.
> > 
> > This sounds like an Extremely Complicated[tm] solution is desired where
> > one doesn't appear to be necessary, just a bunch of little steps:
> > 
> > 1. Have your MTA deliver messages into $HOME/Maildir
> > 
> > Your MTA should tempfail if delivery fails because write() failed [which
> > it would if the user went over quota]. Temporary failures should be
> > retried later.
> > 
> > 2. If you really want to "never bounce [local] messages", consider
> > configuring your MTA to simply never expire local mail- although some
> > users consider bounces useful as it means the recipient didn't receive
> > the mail in a [reasonable] amount of time.
> > 
> > In any event, on qmail this is trivial:
> > 
> > (cd /var/qmail/queue/local && find . -type f) \
> > | awk '{ print "touch -c /var/qmail/queue/info/"$0 }' | sh
> > 
> > could go into your crontab and run (say) once a day or so. If you simply
> > wanted to rejuvenate messages that were deferred due to quotas, you
> > could hook something into repquota.
> > 
> > 3. Finally, to "try as quickly as possible", consider using ngrep
> > 
> > ngrep -s 65535 EXPUNGE 'tcp dst port 143' 2>&1 |  awk '{ if ($0 ~ /^T/)
> > { print "pkill -ALRM qmail-send" } }' | sh
> > 
> > Substituting the "pkill -ALRM qmail-send" for whatever you use to tell
> > your MTA to retry deliveries as soon as possible.
> > 
> > 
> > For the record, you'll note that dovecot isn't involved in any of this,
> > but your MTA needs to do three things:
> > 
> > 1. The Right Thing when write() fails and we're updating the INBOX
> > 2. Provide a way to restart at least local delivery as soon as possible
> > 3. Provide a way to rejuvenate messages
> > 
-- 
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/



More information about the dovecot mailing list