[plug] Sendmail and procmail problems !!!!

Michael Hunt Michael.J.Hunt at usa.net
Wed Nov 3 13:53:46 WST 1999


Hiya all,

Anyone who can give me any help on the following scenario, I am in dire need
of help and am pulling my hair out !!!!

I have a box that uses fetchmail to download mail from an ISP pop mail
account and deliver it locally to one account on the Linux box (RedHat 6.0
running cyrus imap). Currently I have a procmail rule running in the users
home directory that sorts the mail into a Cyrus folder called Common-Inbox
as well as the users home directory.

i.e. part of the .procmailrc file of maildownload user (The user that
fetchmail delivers to)

:0:
* ^TO_*user at domain.com.au
{
        :0 c
        | $DELIVERTO "Common-Inbox"

        :0 A
        ! user at domain.com.au
}

... <Sniped section of file>

:0:
* ^TO_*
| $DELIVERTO "Common-Inbox"

The above section is repeated for every user on the system.

So when a message comes in it gets copied to the Common-Inbox and then sent
locally to the users inbox. (The $DELIVERTO is set to
/usr/cyrus/bin/deliver-wrapper). The final line basically catches all the
mail on the system that doesn't match one of the users addresses and places
it in the Common-Inbox folder.

The problem with the above is that (apart form it being a non standard way
of using a mail system *grin*), when a mail message is cc: to another user
who is further down the list of procmail rules, then they don't receive a
copy of the message. That is the rules once meet mean that the mail doesn't
get delivered to another users even if they were cc: or To: the message.

Now I am really perplexed about how to go about doing this. I could try
nesting But this is very messy. In fact the whole above solution is very
messy requiring editing of the /home/maildownloaduser/,procmail file every
time an account is created.

I have an idea that if I modify the following section in the
/etc/procmail.cyrus file (the system wide one, not the user one as stated
above):

#############################
# All the mail that falls
# through the above recipes
# will be put into the user's
# inbox.  This is always the LAST
# recipe to appear in the file.

:0w
| $DELIVERTO user.$LOGNAME

# If that fails - maybe because the user is out of quota, or the mailbox
# hasn't been created - then force a bounce (otherwise the message would
# get silently appended to /var/spool/mail/$LOGNAME).

# This is EX_CANTCREAT (Can't create output)
EXITCODE=73
:0
/dev/null

#
# End of procmailrc file
##############################

and make it so that mail gets delivered both the user and the common inbox
that I might have a solution to my problem. (I would modify the last
statement so that any mail not addresses to a user would be dumped in the
common-inbox instead of being trashed).

I can't find enough out about procmail to know what the :0w option does.
Anyone know enough about procmail to help me here on this one? I am really
pushed for time on this one and have got other stuff that I need to be doing
apart from trying to read through mounds of doco on this. Hopefully a fresh
outside view might also put things into better perspective.

My other question relates to making sendmail accept and deliver to a
specific account any mail not addressed to a valid user. I think if the
above was to work then such an approach would not be necessary. I would how
ever like to make sendmail deliver the mail locally to this account if the
account that was being addressed to didn't exist.

Thanks for all your help so far and for those who first pointed me to
procmail on this issue.

Michael Hunt




More information about the plug mailing list