my $from = $cgi->param('Email'); { &CheckRequired ($cgi, $required); foreach (@recipients) { open (MAIL, "|$sendmail $_"); print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; print MAIL $cgi->param("Name"); print MAIL $cgi->param("Employee Number"); print MAIL $cgi->param("Seniority Number"); print MAIL $cgi->param("Home Terminal"); print MAIL $cgi->param("RdYd"); print MAIL $cgi->param("Email"); print MAIL $cgi->param("Bid1"); print MAIL $cgi->param("Craft1"); foreach (@data){ chomp; my ($key, $name, $type) = split /\|/; next if ($cgi->param($key) eq ""); if ($type eq "multi") { print MAIL "$name: ", join (", ", $cgi->param($key)), "\n"; } elsif ($type eq "single") { print MAIL "$name: ", $cgi->param($key), "\n"; print MAIL "\n" if ($key eq "Email"); } } #print MAIL "Whatever you want to say."; my $now = localtime; print MAIL "Submitted: $now\n"; close MAIL; } print $cgi->redirect ( -url => $redirect ); }