$mailto[0]="person1\@gmail.com"; $mailto[1]="person2\@hotmail.com"; $mailto[2]="person3\@yahoo.com"; foreach my $element (@mailto) { open MAIL, "| /usr/sbin/sendmail -t -F'$name'" or die "That sucks, I can't open a port on the mail server. I'm going to take all my toys and go home now: $!"; print MAIL "To: $element\n"; print MAIL "Subject: New Form From $name\n"; print MAIL "You have received a new Form.\n"; print MAIL "Please click on the link to finalize process.\n"; print MAIL "New Form Entry is at:\n\n"; close MAIL or die "Error closing sendmail: $!"; }