| [reply] |
I would whole-heartedly concur with this approach - In addition to minimising the work of the script author to write a robust and ruggedly network process, this approach would allow the program to be called 'as-needed' rather than as a daemon process.
Written as a plug-in to a more thoroughly tested and widely used MTA, the script could be called through an /etc/mail/aliases type of pipe such as:
test: "|/usr/local/bin/myscript"
With the corresponding script able to process mail received via reading STDIN. eg.
#!/usr/bin/perl -T
use strict;
undef $/;
my $message = <>;
my ($headers, $body) = split(/\n\n/, $message, 2);
$headers =~ s/\n\s+/ /g;
foreach (split(/\n/, $headers)) {
# ... process headers ...
}
An excellent suggestion IlyaM++
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
| [reply] [d/l] [select] |