Mailing List Archive

qmail-inject taking one file with multiple messages
Hi All

I have a file with about 10 messages in it. All headers correct.

When I use qmail-inject < ./filename it only reads the top of the
file for the headers and therefore the whole ten messages get sent as
one to the first recipient.

Is there any way to have qmail to search the file for all messages
and then send them out ?

Many thanks in advance.
Paul
________________________________________________________
N e t C u l t u r e - Web Hosting
Web: www.NetCulture.net - Email: info@NetCulture.net
Tel: +33 1 45 22 00 02 - Fax: +33 1 45 22 00 52
1 rue Lemercier, 75017 Paris, France
Re: qmail-inject taking one file with multiple messages [ In reply to ]
In <199703180927.EAA05767@jumpgate.erols.com>,
Paul Taylor <paul@NetCulture.net> wrote:

> I have a file with about 10 messages in it. All headers correct.
>
> When I use qmail-inject < ./filename it only reads the top of the
> file for the headers and therefore the whole ten messages get sent as
> one to the first recipient.
>
> Is there any way to have qmail to search the file for all messages
> and then send them out ?

You're thinking at the wrong abstraction level here. One of the wonderful
things about the various UNIXish operating systems is that you can reuse
tried and tested programs and combine them in strange ways, rather than
have to hack qmail (or whatever other program you're dealing with)
to handle all possible cases.

In this instance, get the formail program, which is distributed along with
Stephen van der Berg's procmail distribution. With formail, you can do
something along the lines of:

handler@jumpgate ~$ formail -s qmail-inject < ./filename

The '-s' option to formail tells it to assume the standard input will be
an mbox format mailbox, to break it up on the mbox delimiter (^From_),
and to spawn a copy of whatever argument you give it after the '-s' for
each individual message, and feed the message to the specified program
on standard input. That will achieve what you're trying to do.

Procmail can be found at
<ftp://ftp.informatik.rwth-aachen.de/pub/packages/procmail/procmail.tar.gz>

--
Michael Handler <handler@sub-rosa.com> Washington, D.C.

I've heard that the son must bear the burdens of the father
but it's the daughter that is left to clean up the mess
-- cowboy junkies, "First Recollection"
Re: qmail-inject taking one file with multiple messages [ In reply to ]
At 10:25 AM 3/18/97 +0000, Paul Taylor wrote:
>Hi All
>
>I have a file with about 10 messages in it. All headers correct.
>
>When I use qmail-inject < ./filename it only reads the top of the
>file for the headers and therefore the whole ten messages get sent as
>one to the first recipient.
>
>Is there any way to have qmail to search the file for all messages
>and then send them out ?

That conflicts pretty badly with the format of mails in general. Namely
header lines followed by a blank line followed by data. What pattern or
string are you using that separate the mails from each other and how can you
be sure it's not going to be in the body of the mail?

In general, it would be a very bad thing from qmail-inject to do something
like this, however a trivial perl script that preprocesses your mail is
probably the best thing.


Regards.