#!/usr/local/bin/perl # # Based on # white-form.pl -- cgi compliant interface to mail // Jun 20 1994 # (C) Christian Neuss, Fraunhofer IGD (neuss@igd.fhg.de) # # Customizing by Brian Lucas, lucas@mbnet.mb.ca # # This is the demonstration of a generic inquiry form for the LI Demo page # #--------------------------------------------------------------------- # CUSTOMIZATION #--------------------------------------------------------------------- # The address to which this script will send mail local($mailto)="admin\@towd.com"; # The path to this script local($scriptname)="sendmail.pl.cgi"; #The title to be put in the ... element local($pagetitle)="Tourism Offices Worldwide Directory"; # The title to be displayed with

...

local($title)="Tourism Offices Worldwide Directory"; # The machine on which this page is stored -- for the mail out local($machineid)="access.mbnet.mb.ca"; # The page which the user is directed to after it's all over local($gotopage)="http://205.200.106.101/"; local($gotopagename)="Tourism Offices Worldwide Directory"; #--------------------------------------------------------------------- sub display_form { print "Content-type: text/html\n\n"; print "\n$pagetitle\n"; print "\n"; print "

$title

\n"; print "This form may be used to report changes or errors or to request a listing for your official government agency or convention and visitors bureau."; print "

Please do not send requests for travel information using this form. "; print "Although we maintain the list of tourism offices, we do not stock any tourist information (brochures, maps, etc.) ourselves; all of that information must be otained directly from the relevant tourist office. "; print "Many offices do not provide service by email, so you will have to telephone them, or write a letter on paper. "; print "We cannot relay messages to tourist information offices for you, and any requests that we receive for tourist information will be rejected or ignored. "; print "As well, we are not a travel agency and so we cannot provide information about transportation fares and schedules, or accommodations. "; print "You may wish to visit the Rec.Travel Library for additional travel information, or return to the Tourism Offices Worldwide Directory to contact a tourist information of fice directly. "; print "


"; print "
\n"; print "Your name
\n"; print "Your email address
\n"; print "(Type carefully! Every day we receive at least one message to which we cannot reply because the email address given is invalid!)\n"; print "

Enter your message here:
\n"; print "
"; print "



\n"; print "

"; print " "; print "
"; print "

\n"; } sub doit { local(@query_strings) = split("&", $ENV{"QUERY_STRING"}); foreach $q (@query_strings) { ($attr, $val) = split("=", $q); $val =~ s/\+/ /g; $val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $queryvals{$attr} = $val; } do { &'display_form; return; } unless ($queryvals{SEND} eq "SEND"); $name = $queryvals{NAME}; $email = $queryvals{EMAIL}; $content = $queryvals{CONTENT}; $return = $queryvals{RETURN}; $subject = $queryvals{SUBJECT}; ### check "does mail look like an adress etc if($name eq "" || $email eq ""){ print "Content-type: text/html\n\n"; print "\nMail not sent\n"; print "\n\n"; print "\n

Mail not sent!

\n"; if($name eq ""){ print "You did not give your name. \n"; } if($email eq ""){ print "You did not give your email address. \n"; } if($content eq ""){ print "Your message was empty. \n"; } print "

Try again
\n"; do {print "Return to last page
"} unless ($return eq ""); print "Go to $gotopagename\n"; print "\n"; } else { open(MAIL, "|/usr/lib/sendmail $mailto") || die "Unable to open mail progr am.\n"; print MAIL "Reply-to: $email ($name)\n"; print MAIL "Subject: $subject\n\n"; print MAIL "From: $name\n"; print MAIL "Email: $email\n"; print MAIL "$content\n"; close(MAIL); print "Content-type: text/html\n\n"; print "\n$pagetitle\n"; print "\n\n"; print "\n

Thank you

\n"; print "Thank you for your mail.

\n"; print "Go to Tourism Offices Worldwide Directory"; print "\n"; } } &doit();