[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sorting locally delivered email using Procmail



On Mon, Oct 07, 2002 at 04:29:58AM -0400, Andy Saxena wrote:
> 
> For details, please read my original posting. Here's the situation in
> brief:
> Deliver local mail to users in such a way that they can run their
> procmail recipes. For e.g., if a user gets all the mail about cron jobs,
> he should be able to direct that into the =inbox.cron folder.
> 

I found the solution! Procmail was generating the "From " envelope
header that cyrdeliver finds inacceptable! It seems if you call procmail
from exim, it runs in an explicit delivery mode (whatever that means)
and adds the "From " header to the incoming email. My solution is really
simple. I used formail to get rid of the "From " header like so:


----------------------~/.procmailrc (begin)-----------------------------
SHELL="/bin/sh"
DELIVERMAIL="/usr/sbin/cyrdeliver"
LOGFILE="$HOME/.maillog"
IMAP="$DELIVERMAIL -a andy -q -m user.andy"
LOGABSTRACT="all"
VERBOSE="on"

#Remove the "From " header if it exists! Pass on the email to the other
#filters.
:0 fw

| /usr/bin/formail -I 'From ' -b

----------------------~/.procmailrc (end)-----------------------------


Exim is configured in the following manner:

---------------------/etc/exim/exim.conf (begin)-----------------------

######################################################################
#                      TRANSPORTS CONFIGURATION                      #
######################################################################
#                       ORDER DOES NOT MATTER                        #
#     Only one appropriate transport is called for each delivery.    #
######################################################################

# This transport is used for local delivery to user mailboxes. 

local_delivery:
  driver = pipe
  command = /usr/sbin/cyrdeliver ${local_part}
  return_path_add = true
  return_output
  prefix = ""
  user = cyrus

# This transport is used for procmail

procmail_pipe:
  driver = pipe
  command = "/usr/bin/procmail"
  return_path_add
  delivery_date_add
  envelope_to_add
# check_string = "From "
# escape_string = ">From "
#  suffix = ""
  user = $local_part
  group = mail


######################################################################
#                      DIRECTORS CONFIGURATION                       #
#             Specifies how local addresses are handled              #
######################################################################
#                          ORDER DOES MATTER                         #
#   A local address is passed to each in turn until it is accepted.  #
######################################################################

# This director runs procmail for users who have a .procmailrc file

procmail:
  driver = localuser
  transport = procmail_pipe
  require_files = ${local_part}:+${home}:+${home}/.procmailrc:+/usr/bin/procmail
  no_verify
    
# This director matches local user mailboxes. Since procmail does all
# delivery, it is never used.

localuser:
  driver = localuser
  transport = local_delivery

end

---------------------/etc/exim/exim.conf (end)-------------------------

Please keep in mind that the above two illustrations are abridged
versions.

I am surprised that nobody else has faced this problem. It's hard to
imagine that I am the only one wanting to use Cyrus IMAP and sort all
the email into their various folders using procmail. Are there more
elegant solutions out there?

-Andy



Reply to: