#!/usr/bin/perl -w $sendmail = '/usr/sbin/sendmail'; $sender = '...'; $recipient = '...'; $site_name = 'LHP'; $site_url = '...'; $filename = 'alumnos_LHP_2003-2004.txt'; use CGI; $query = new CGI; foreach $field (sort ($query->param)) { foreach $value ($query->param($field)) { $mail_body .= "$field: $value \n"; } } if (($email = $query->param('07_email')) and ($query->param('07_email') =~ /@/)) { if ($name = $query->param('01_name')) { $name =~ s/"//g; $sender = "\"$name\" <$email>"; } else { $sender = "$email"; } } #======================= #send the email message open(MAIL, "|$sendmail -oi -t") or die "Can't open pipe to $sendmail: $!\n"; print MAIL "To: $recipient\n"; print MAIL "From: $sender\n"; print MAIL "Subject: Ficha alumno LHP\n\n"; print MAIL "$mail_body"; close(MAIL) or die "Can't close pipe to $sendmail: $!\n"; print "Content-type: text/html\n\n"; print <<"EOF"; <HTML> <HEAD> <TITLE>Gracias!</TITLE> </HEAD> <BODY LINK="#0000ff" VLINK="#800080" BACKGROUND="http://nereida.deioc.ull.es/images/BACKORCHESTRA.JPG"> <H1>¡Gracias!</H1> <B> LHP </B> </P> <P><img src="http://nereida.deioc.ull.es/images/birds1.gif"></P> <P>Volver a <A HREF="$site_url" target=_top>$site_name</A>.</P> </BODY> </HTML> EOF