#!/usr/local/bin/perl # Credits: Dr. William R. Somsky for his # insights as well as the code snippet that formats the outgoing # email. require 'cgi-lib.pl'; print &PrintHeader; &ReadParse(*form); $recipient = "royward\@u.washington.edu"; $subject = "New Form Submission"; # send the email message open(MAIL, "| /usr/lib/sendmail -n -oi -t"); print MAIL "To: $recipient\n"; print MAIL "Subject: $subject\n"; print MAIL "\n"; foreach $name (sort keys(%form)) { $label = "$name:"; foreach $value (split("\0", $form{$name})) { my @lines = split ("\n", $value) ; foreach (@lines) { $_ =~ s/\r$// ; } printf MAIL "%-15s%s", $label, length $label <= 15 ? "\t" : "\n\t\t" ; print MAIL join("\n\t\t", @lines), "\n" ; } } close (MAIL); # send back a response print < Form Submitted

Form submitted

HTML_RESPONSE exit;