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

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:

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

  • Comment on Re: Re: Re: Re: Re: accessing mailbox files

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: accessing mailbox files
by jc23 (Acolyte) on Jul 30, 2003 at 18:56 UTC
    Hey Cees, Excellent command. I ran the

    cat msg | formail +1 -ds /usr/lib/sendmail  -oem <dest addy> and it works great when msg is one big mbox file with multiple messages inside. I was wondering can I run that command if msg contains just one email file? I want to do something like  cat msg | /usr/lib/sendmail -m <dest> in a loop for a directory of files, but that command doesnt work at all.

    thanks

    jc

      Well, since an mbox file could have just one message, I assume that it will work. Just remove the '+1' from the formail command, as that would just skip the only message in the file.

      cat singlemsg | formail -ds sendmail -oem <dest addy>

      I haven't tested that, but since I don't have a copy of one of your messages, it would do no good for me to test it anyway...

      Cheers,

      Cees