[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I am writting a custom script which takes the incoming mail address (this
> script is going to be called from inside a .qmail file) and puts it into a
> Maildir. I can't use the current qmail controls to put mail into the
> maildir, as I need to query a database to find the correct mail box and do
> some other things.
condredirect could be used to do this. Make the condition that
condredirect depends on be the database query (even done with your
database's batch mode console tool if you like).
However, a custom application, as you are planning, is still possible.
> I am writting the script in Perl. I read the maildir man page, and just
> need to confirm a few things with the experts :-)
>
> This is how I am doing to store a message in a maildir -
>
> - Change dir to the maildir area
> - Create tmp/time.pid.hostname file, this contains the incoming email
>
> Now am not sure if I should rename tmp/time.pid.hostname to
> new/time.pid.hostname -OR- move tmp/time.pid.hostname to
> new/time.pid.hostname. This is where I need a little point in the right
> direction.
Rename is guaranteed to be atomic, but will fail across filesystems.
Move works across filesystems but in that case isn't atomic. Use
rename.
> Is that everything to store the message? Or do I need to carry any more
> steps to make sure the message is stored correctly and safely.
Sync the file after each file operation.
Charles
--
-----------------------------------------------------------------------
Charles Cazabon <[EMAIL PROTECTED]>
GPL'ed software available at: http://www.qcc.sk.ca/~charlesc/software/
-----------------------------------------------------------------------