#Get the user's email, this is fine use CGI; $q = new CGI unless @ARGV; $email = $ARGV[0] || $q->param("email"); #Open sendmail to send the mail, this is not fine open(MAIL, "|/usr/lib/sendmail $email"); print MAIL $mailMessage;