On Thu, Feb 14, 2019 at 07:17:49PM +1100, [email protected] wrote:
> 1) Pick the mail out of the inbox in your script(s), or
> 2) deliver each mail directly to a converting filter if your pipeline
>    prefers that, and can buffer adequately.

Yes. Break larger tasks into multiple smaller tasks, each of which is either
easily solvable or already has tried-and-tested solutions.

> To attempt to mix up post-arrival grist milling with mail delivery makes no
> sense, I suggest. An inbox makes a fine buffer between the two temporally
> disconnected activities, each with its own fluctuating data rate, but any
> buffer will do.

In other words, the inbox is a queue for other script(s) to process in order,
without having to complicate those scripts by adding a poor imitation of an
already-existing, full-featured, and debugged imap mail fetcher.

Alternatively if using an MDA like procmail or deliver (or some other
programmable MDA), incoming mail can be automatically piped into the
appropriate mail-processing script when it arrives, with pattern rules
allowing mail to be delivered to one (or more) of several different scripts
depending on which pattern(s) any given message matches.

Matchable patterns include headers such as To:, From:, Subject:, X-Mailer:,
and body text (these days, it's worthwhile getting procmail/deliver/whatever
to mime-decode the text/plain or text/html attachments BEFORE trying to match
patterns in the body)

Using existing MDA like this allows your script to just do the one thing it
has to do (i.e. process the mail) without also having to fetch it and/or
decide whether that message is one that should be processed by the script.



In short: don't re-invent the wheel, especially when there are already several
good wheels to choose from, each with decaades of bug-fixes and refinement.
Instead, use multiple small tools, each of which is exceptionally good at the
one thing it does.

craig

--
craig sanders <[email protected]>

BOFH excuse #249:

Unfortunately we have run out of bits/bytes/whatever. Don't worry, the next 
supply will be coming next week.
_______________________________________________
luv-main mailing list
[email protected]
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main

Reply via email to