use strict; use Getopt::Long; my $email; my $option = GetOptions ( "email=s" => $email ); my $from = "blah@blah.com"; my $subject = "HI HI HI"; my $body = "HI HI HI"; sub sendEmail { my ( $to, $from, $subject, $message ) = @_; my $sendmail = '/usr/lib/sendmail'; open(MAIL, "|$sendmail -oi -t"); print MAIL "From: $from\n"; print MAIL "To: $to\n"; print MAIL "Subject: $subject\n\n"; print MAIL "$message\n"; close(MAIL); } sendEmail ( $email, $from, $subject, $body );