Re: Re: Re: accessing mailbox files
by Limbic~Region (Chancellor) on Jul 28, 2003 at 22:33 UTC
|
| [reply] |
|
|
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.
| [reply] |
|
|
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
| [reply] |
|
|
Re: Re: Re: accessing mailbox files
by saintbrie (Scribe) on Jul 29, 2003 at 00:27 UTC
|
Reinventing the wheel and all that. I sound like a broken record, I guess, but I have some questions.
Q: It looks to me like if the $dirContent file has more than one message in it, you won't forward other than the first messages. Is that the case?
Q: Are you just forwarding ALL of the mail sent to a given user? If so, how is this superior to a .forward file in the user's home directory that contains: recip@email.com?
Q: If you are filtering mail to a user based on some criteria, how is this superior to using procmail? e.g. a .procmailrc file that filters for Perlmonks in the subject:
:0:
* ^Subject:.*Perlmonks.*
! recip@email.com
| [reply] [d/l] |
|
|
Saintbrie,
To clarify, I am forwarding all messages in a single local mail folder, not all contents of inbox. I'm not sure how to do this in procmail, so I haven't used that laternative.
Secondly, mail in the folder that is being forwarded, isn't incoming mail. It is mail that has been drag and dropped from a separate mail folder using dtmail. In other words, it is mail that the user has chosen to send out to a single alias. By putting all the mail to be sent to one address in a folder and having it automatically send, it is less tedious.
Hope that clarifies.
jc
| [reply] |
|
|
| [reply] |
Re: Re: Re: accessing mailbox files
by cees (Curate) on Jul 29, 2003 at 03:45 UTC
|
If all you are trying to do is to take some raw email messages in files and forward them to another account, then look at using formail. It is installed along side sendmail, and is useful for parsing email messages.
I have used the following to send an entire mbox file to another user:
cat <mboxfile> | formail +1 -ds sendmail -oem <dest-address>
I admit that I have not read your other questions, so I may be off base with what you are trying to achieve, but I always think it wise to look at the tools you have available with your mail system before starting to write your own...
- Cees | [reply] [d/l] |
|
|
| [reply] |
|
|
Yes it will allow this. With the command I gave you above, formail will parse the mbox file, split out the separate email messages, and pipe each message to sendmail. Sendmail gets the parameters -oem <dest-address> which will send the mails to that email address. So if you had 5 messages in your mbox file, sendmail will send 5 separate messages.
Here is what the switches do:
- +1 skip the first message in the file (usually a POP3 header)
- -d the file does not have to be in strict mbox format
- -s execute the following command for each message. in this case execute 'sendmail -oem <dest-address>'
A quick search on google found many man pages on formail. They might give some more insight into what it can do. The best way to learn is just to try it out and see.
By the way, I initially said that formail came with sendmail. That was incorrect. It comes as part of the procmail package.
- Cees
| [reply] |
|
|
|
|