Re: [exim] Using IMAP folders as quarantine

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

>
> |...
> | check the mail because I retained Maildir_format. Now, what if I started
> | a second Exim process for only sending out mail through a manual route
> | and made its queue one of the IMAP folders, e.g.
> | /path/to/Maildir/.queue/cur. If I dragged and dropped the batched emails
> | _one at a time_ into that folder, would the second Exim process pick up
> | the email and send it on without a hitch?
>
> No. Exim's queue (aka spool) does not (and could not) use maildir
> format. I guess you could write your own daemon to check for
> messages in that folder and write them to exim's spool in the
> appropriate format. See Chapter 52, "Format of spool files", if you
> want to try that.


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

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



I appreciate your suggestions to this point. Please let me know if you
think this is practical and reliable.

Thanks,
Craig Jackson