Before you open the pipe to sendmail but after parsing the CGI query into %FORM, you need to change the $recipients based on the checkbox value:
if ($FORM{'chkno'}) {
$recipients .= " foo@example.com";
}
<code>
Then, the command will look like:
<code>
|/usr/lib/sendmail yogibear@test.edu foo@example.com
The To: line needs to have commas separating the addresses instead of spaces.
To: yogibear@test.edu, foo@example.com
Finally, you need to add a blank line between the end of the headers and the start of the HTML.
print MAIL "Content-Transfer-Encoding: 7bit\n";
print "\n";
print MAIL "<html><head>\n";
|