Re: [exim] Using IMAP folders as quarantine

Top Page
Delete this message
Reply to this message
Author: Craig Jackson
Date:  
To: exim-users
Subject: Re: [exim] Using IMAP folders as quarantine
Fred Viles wrote:
> On 22 May 2005 at 22:08, Craig Jackson wrote about
>     "Re: [exim] Using IMAP folders as qu":

>
> |...
> | Well, because I'm a not too smart guy, this is the best I can come up
> | with: email that needs to be released can be copied using IMAP MUA into
> | a Release folder. This rough draft cron script runs every minute:
> |
> | #!/bin/bash
> |
> | QUEUEDIR=/var/spool/exim/vmail/postmaster/Maildir/cur
>
> Should be
> QUEUEDIR=/var/spool/exim/vmail/postmaster/Maildir/.Release
> or some such, shouldn't it?
>
> | for EMAIL in `ls $QUEUEDIR`
> | do
> |    RECIPIENTS=""
> |    RCPT_LIST=`egrep "^RCPT TO:" $QUEUEDIR/$EMAIL | egrep -o \
> |     "[^<]+@[^>]+"`
> |          for RECIPIENT in $RCPT_LIST
> |          do
> |                  RECIPIENTS="$RECIPIENTS,$RECIPIENT"
> |          done
> |          RECIPIENTS=`echo $RECIPIENTS | sed "s/^,//"`
> | 
> |          SENDER=`egrep "^MAIL FROM:" $QUEUEDIR/$EMAIL | egrep -o \
> |         "[^<]+@[^>]+"`
> | 
> |          egrep -v "(^MAIL FROM:|^RCPT TO:|^DATA)" $QUEUEDIR/$EMAIL > \
> |         email.tmp
> |          /usr/local/exim/bin/exim -f $SENDER -oi -oem -bm $RECIPIENTS < \
> |         email.tmp
> | done

>
> Interesting, I didn't pay attention to the implications of batch_max
> and use_bsmtp in the transport you posted earlier. I haven't done
> this sort of thing, but assuming that the BSMTP file format (ie the
> RCPT TO: and MAIL FROM: lines) doesn't cause problems with your IMAP
> server, it should work.
>
> An advantage of the BSMTP format is that you can feed it to exim
> directly, no need to extract the sender & recipients in your script:
>
> ...
> do
>     /usr/local/exim/bin/exim -bS <$QUEUEDIR/$EMAIL
>     rm -f $QUEUEDIR/$EMAIL
> done

>
> The script would have to run as a trusted user for the sender address
> to be honored, and there's the possibility of a race between the IMAP
> server writing a file and the script reading it. There may be other
> issues as well.
>


Ah, I understand that now. I will recompile Courier-imap to pass -bS
instead of all the Sendmail arguments and that will take care of that
problem -- no script needed at all!

Thanks to all who have responded.
Craig Jackson