procmail
[Top] [All Lists]

Re: Procmail/Perl and locking

2004-07-14 05:59:39


Paul Chvostek wrote:

On Wed, Jul 14, 2004 at 01:46:22PM +0200, Sven Schmitt wrote:

I made a Perl script which converts some filecontent into several
emails. At the end of the script, I have a bunch of emails stored in a
variable (formatted like a standard mailbox). So far, everything works
perfect.

All left to do is to append the content of the variable to the mailbox.

...

Now I wonder if the above Perl code will be safe, or if there
still is the chance that I run into Procmail/Perl file access problems.
If so, has anybody a better idea (or link)?


I'd suggest you use procmail for local delivery, rather than rolling
your own.  Parse the variable, feed each message to procmail.  If you
want your code to be flexible enough to handle multiple environments and
future upgrades (who knows -- perhaps a user really want to store things
in Maildirs instead of mbox), then you should let procmail do its job.

To make the process easier, perhaps store each email in an array element
rather than appending them to a single variable.  But I'm no perl guru,
I can't give you code examples.

I though about that too, but I was assuming it would be faster to write everything directly into the mailbox instead of calling procmail for every single mail. While it may not matter when I deliver 20-80 mails to myself per run, it might if I decide to make this available to all users on the server.

Besides, I'd like to keep those mails out of my log (I generate spam/ham/virii stats from it).

The mailblocks are already in an array since I was planning a multiuser option. I thought it would be easier to explain the single user version. Sorry for the mixup.




____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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