Index: /trunk/arclog/arclog.pl
===================================================================
--- /trunk/arclog/arclog.pl	(revision 19142)
+++ /trunk/arclog/arclog.pl	(revision 19143)
@@ -3,4 +3,5 @@
 use strict;
 use warnings;
+
 use vars qw( $VERSION );
 $VERSION = '0.01';
@@ -13,8 +14,15 @@
 use DateTime::Format::Strptime;
 use DBI;
-
-#use Getopt::Long qw( GetOptions :config auto_help auto_version );
+use Email::Send;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version );
 use Pod::Usage qw( pod2usage );
-# accept no options
+
+my ($email);
+
+GetOptions(
+    'email|s=s'    => \$email,
+) || pod2usage( 2 );
+
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 
@@ -34,4 +42,14 @@
 $dbh->do("CREATE TABLE IF NOT EXISTS log(record TEXT, PRIMARY KEY(record))")
     or die "db error";
+
+my $errors;
+my $output;
+###
+if (defined $email) {
+    close(STDOUT);
+    close(STDERR);
+    open(STDOUT, '>', \$output) or die "Can't open STDOUT: $!";
+    open(STDERR, '>', \$errors) or die "Can't open STDERR: $!";
+}
 
 # HTTP authentication realm
@@ -174,4 +192,17 @@
     use warnings;
 }
+
+my $message =<<END;
+To: $email
+From: jhoblitt\@ifa.hawaii.edu
+Subject: output from arclog.pl
+
+$errors
+$output
+END
+
+my $sender = Email::Send->new({mailer => 'SMTP'});
+$sender->mailer_args([Host => 'hale.ifa.hawaii.edu']);
+$sender->send($message);
 
 
