procmail
[Top] [All Lists]

Re: Mail folder formats..

1999-09-20 21:03:23
Umar Goldeli <umar(_at_)atlas(_dot_)synflux(_dot_)com(_dot_)au> writes:
I hope someone can help me with a little problem I have at the moment -
I've got sendmail passing mail to procmail via the mailertable with
entries such as:

blah.com       procmail:/etc/mail/procmailrc.blah.com


etc etc..


And somewhere along the procmail script, it saves to a user's folder by
separating the username and the domain and saving a filename which is the
user's name..

The problem is that the folder is not in standard format.. :( i.e. the
message delimeter is usually "\n\nFrom:" isn't it? Because the mail file
doesn't appear to have that delimeter..

Is there an option that will allow me to do that within the script?

You can do it from the rcfile by filtering the header through formail:

        # If there isn't a From_ line, use formail to add one
        :0 fhw
        * ^^From ()
        |formail

That would go before the recipes that deliver to mbox folders.

Alternatively, you can fix up the format at delivery time:

        # Force mbox format via formail as we deliver
        :0 w:
        |formail >>mailfolder

Which of those is more efficient depends on the exact nature of the
message that you're working with (header size vs body size, etc), but
the difference is insignificant enough that I wouldn't worry about it.**

The other, non-rcfile, solution is to add the 'f' flag to the procmail
mailer in the sendmail.cf.  This affects *all* invocations of the
procmail mailer, so think carefully whether this might cause problems
with, for example, other rcfiles mentioned in the mailertable.


Philip Guenther

** The filtering method has a slight advantage over the doing the fixup
at delivery time if the user that procmail is running as could be close
to its disk quota or if the disk might fill up.  When procmail does a
delivery to a mbox-style folder, if the delivery fails part way through
then procmail will truncate the mailbox back to its original size before
considering the delivery a failure.

<Prev in Thread] Current Thread [Next in Thread>