To: er@foo.bar From: Joe User Subject: Anything url: http://www.domain.com/ depth: 3 title: This is my title #### use strict; use diagnostics; use warnings; use Date::Manip; use Mail::Mailer; my $date = UnixDate("today","%T on %b %e, %Y."); my $logfile = "/var/log/foo.bar.log"; my $mailer = Mail::Mailer->new(); my $admin = "admin\@foo.bar"; my $server_from = "\"Foo Reflector\" "; my $a = 1; my ($body, # entire message $message_header, # headers of message $message_body, # just the body itself $help, # help context ); while (<>) { my $line = $_; my $from = $line if /^From: /; help() if (/Subject.*?help.*/i); $body .= $line; $a++; } ($message_header = $body) =~ s/(.*?)\n\n.*/$1/s; ($message_body = $body) =~ s/.*?\n\n(.*)/$1/s; mail_admin(); open (LOGFILE, ">>$logfile") or die "$!"; print LOGFILE "-"x20, "\n"; print LOGFILE "$date - complete $0\n"; close LOGFILE; ########################################## # # Mail the administrator # ########################################## sub mail_admin { my $from =~ s/From: (.*)/$1/; chop($from); my $mailer->open({ From => $server_from, To => $from, Cc => $admin, Subject => "Test at $date", }) or die "Can't open $!\n"; print $mailer<close; } ########################################## # # Display reponse to Help # ########################################## sub help { $help = " This is the help file. Thanks for needing help. If this had this been Real Help(tm), it would have helped. "; }