in reply to Re: Re: accessing mailbox files
in thread accessing mailbox files

jc23,
Ok - you look like you are well on your way. I have a few points:
  • my $recip = $recipient; is redundent. Just define $recipient as $recip at the top.
  • `rm $dirContent`; You should never use backticks in a void context. Use system if you are not concerned with capturing the output. In this case, I feel you should use neither. Perl has unlink.
  • I would recommend Perltidy for help in indenting/formatting.
  • A lot of your variables look to be used only once. If this is left over stuff, take the time to clean it up. It can help troubleshooting later.

    Finally - you still haven't described what process gets those messages to the files in the directory in the first place:

  • Is it a special Sendmail configuration?
  • Is it an alias that is actually a pipe to a script?
  • Is it something else?
    It is possible you could solve this problem earlier by putting in a fork: Write to this directory as well as forward a copy to a different recipient. This is probably the best thing to do anyway.

    Cheers - L~R

  • Replies are listed 'Best First'.
    Re: Re: Re: Re: accessing mailbox files
    by jc23 (Acolyte) on Jul 29, 2003 at 03:34 UTC
      L~R,

      Here's the big picture: The user chooses to send a bunch of messages to an alias that will later post everything onto a webboard. Instead of sending each mail separate, the user can drag and drop all da mail files he wants posted or any original email he writes into the folder *temp*. THe script I was asking for help on, will then go through the folder and "forward" each piece of mail to the alias. I wanted this "Forwarding" step to be automatic.

      I'm not sure what you mean by *forks*. If this is a more efficient process than the script, could you please tell me how to set this up?

      Lastly, someone mentioned that all messages in a mailbox is kept in one file. Does the code you posted earlier allow each message to be grabbed from the one index file and sent out separately?

      thanks for the help.

      jc

      PS I will go back and clean up the variables and formatting. I pulled that portion of it out of a larger context.

        jc23,
        Ok - which is it - they are all seperate messages in seperate files or they are all stored in one file? I can't answer that question - you have to. The code that I provided was based off 1 message per 1 file. You are going to want to use different code and a different module if it is a regular *nix mbox file. Which is frustrating since you told me all my original assumptions were correct. It sounds to me like you are putting the cart before the horse since it doesn't appear you have a good handle on the piece that gets the mail to the folder in the first place.

        Cheers - L~R

          L~R,

          Sorry for the confusion. I should have verified the mail format before I gave you the ok. You are correct. I am using a regular unix mbox file. So that means everything would be in a single file. Someone mentioned that it was possible to just forward an entire folder using formail? Do you know anything about that?

          Thanks. i really appreciate your responses.

          jc