#!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; my $request = new CGI; my @emaillist = ("name\@domain.com","anothername\@anotherdomain.com"); my $messagebody = ""; my @form_fields = $request -> param; my $thankyoupage = 'http://www.domain.com/Thanks.html'; my $field = ""; foreach $field (@form_fields) { my $value = $request -> param ($field); my $f = uc ($field); $messagebody .= $value . "\n\n"; } my $n = ""; foreach $n (@emaillist) { open(MAIL, "|/usr/sbin/sendmail -t") or die "Could not open Sendmail \n\n $!"; print MAIL "To: $n\n"; print MAIL "From: newsletter\@domain.com\n"; print MAIL "Subject: The Weekly Newsletter\n"; print MAIL "Content-type: text/plain\n\n"; print MAIL "$messagebody\n\n"; close(MAIL) or die "Could not close Sendmail \n\n $!"; } print "Location: $thankyoupage\n\n"; exit;