:0 h b * !^FROM_DAEMON * !^X-Loop: igor@jcwren.dyndns.org | ~/test.pl #### #!/usr/local/bin/perl -w use strict; use Mail::Internet; my %commands = ("help" => \&do_help, "commands" => \&do_help, "weather" => \&do_weather); { my $rreplytext = [ ]; my @maildata = <>; my $mail = new Mail::Internet (\@maildata); $mail->remove_sig (); $mail->tidy_body (); foreach (@{$mail->body ()}) { chomp; tr /A-Z/a-z/; if (exists $commands {$_}) { $rreplytext = [ @$rreplytext, "Results for command '$_'\n", &{$commands {$_}}, "\n" ]; } else { $rreplytext = [ @$rreplytext, "Unknown command '$_'\n" ]; } } $rreplytext = [ @$rreplytext, "----\n", "Send 'help' or 'commands' in the body for supported commands\n", "\n", "Generated by igor\@jcwren.dyndns.org\n" ]; my $reply = $mail->reply (); $reply->body ($rreplytext); $reply->smtpsend (Host => 'localhost'); } sub do_help { my @text = (); push @text, "$_\n" foreach sort keys %commands; return (@text); } sub do_weather { `/home/system/weather/wx.pl 2>&1`; }