in reply to Re: Re: perl scripts as daemons
in thread perl scripts as daemons
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'
|
|---|