#!/usr/local/bin/perl # Script: mail_to.cgi # Modified 19oct96 for use at the bmwnorcal.org site at digiweb # Copyright 1996 Scot J. Marburger # All rights reserved # Permission to use this script without the written permission # of the author is denied # BEGIN { unshift(@INC, '/www/bmwnorcal/html/cgi'); } require "CGI.pm"; require "home_def.cgi"; require "sjm_lib.cgi"; #set up storage for form input $query = new CGI; # Configure the script here... $method = 'POST'; $MAIL_TO = 'webmaster@bmwnorcal.org'; # who to send the mail to $author = 'scot@gunsmoke.com'; $OWNER = 'The BMW Club of Northern California'; # organization that the script is written for $TITLE = '\@#%& NorCal Mail &%#\@'; # title at the top of the web page $YEAR = "1997"; $script_file = $cgiHOME."/mail_scripts/mail_to.cgi"; $url_home = "http://www.bmwnorcal.org"; $url_mail_script = "http://www.bmwnorcal.org/cgi/norcal/mail_scripts/mail_to.cgi"; # Image file urls $img_logo = "http://www.bmwnorcal.org/norcal/images/norcal_logo.gif"; $img_logo_size = "WIDTH=180 HEIGHT=179"; $img_button_send = "http://www.bmwnorcal.org/norcal/images/button_send.gif"; $img_button_clear = "http://www.bmwnorcal.org/norcal/images/button_clear.gif"; $img_line_marble_red = "http://www.bmwnorcal.org/norcal/images/line_marble_red.gif"; $img_arrow_marble_red = "http://www.bmwnorcal.org/norcal/images/arrow_marble_red.gif"; $img_background = "http://www.bmwnorcal.org/norcal/images/norcal_logo_embos.gif"; # print the html header for text/html print $query->header; # print the canned HTML header print $query->start_html( -title=>$TITLE, -author=>$author, -BGCOLOR=>'#FFFFFF', -BACKGROUND=>$img_background ); # put the usual stuff at the top of the form print "
\"[$OWNER]\"

"; print "
Email Response Form

"; # # Both query and reply forms are in the same file. So if there # are answers in $query->param, use the reply form. $query->param # will be NULL the first time the script is called, so the query # form will be used. # if ( $query->param( 'send_button.x' ) ) { &do_work( $query ); # we got params, so reply } else { # &do_work( $query ); # uncomment this line to debug 2nd half of script &clean_up( $query ); # zero out all the fields for a clean start &print_prompt( $query ); # no params, so query } # save name of page that made original call print $query->hidden( 'caller', $query->referer() ); print $query->endform; &print_tail( $script_file ); print $query->end_html; # That's all, folks! # ------------ Create the query form ----------- sub print_prompt { local( $query ) = @_; print $query->startform( $method ); print $query->image_button( -name=>'send_button', -src=>$img_button_send, -align=>'LEFT BORDER=0 WIDTH=108 HEIGHT=48 ALT=\"SEND\"'); print $query->image_button( -name=>'clear_button', -src=>$img_button_clear, -align=>'LEFT BORDER=0 WIDTH=108 HEIGHT=48 ALT=\"CLEAR\"'); print "


";
     print "Mail To:        $MAIL_TO";  
     print "
"; print "Copy To: ", $query->textfield( -name=>'copy_to', -default=>'', -size=>35); print "
"; print "From: ", $query->textfield( -name=>'name', -default=>'Needed For A Reply', -size=>35); print "
"; print "Sender's email: ", $query->textfield( -name=>'from', -default=>'Needed For A Reply', -size=>35); print "
"; print "Subject: ", $query->textfield( -name=>'subject', default=>$TITLE, -size=>35); print "
"; print "
"; print "Its always nice to hear from fellow net denizens. Just use ", "the window above to drop us a note. We'll usually respond ", "in a day or so. ", "

", "Please be sure your email address is properly entered to ensure ", " that we can reply to you.
", "Please! If you are writing to report a problem with the ", "web site, include the following information in your note:
", "The url of the page that the error occured on.
", "Any error message that appears (Tip: use copy and paste to enter ", "the error text into the text box below).
", "The url of any broken link you find (and the replacement link ", "you found using ", "", "Alta Vista if you want big brownies from", "the WebMaster!).
", "Your email address, just in case we have any questions.

"; print "

", $query->textarea( -name=>'letter_text', -default=>'', -rows=>20, -columns=>80); print "


"; print <


We would appreciate a few moments of your time to answer these questions. The answers will help us serve you better. Thanks.

END print "

How would you rate the organization of this Web Site?
", $query->popup_menu( 'organization', ['Excellent', 'Good', 'Average', 'Terrible'], 'Excellent'); print "

How would you rate page content quality?
", $query->popup_menu( 'contents', ['Excellent', 'Good', 'Average', 'Terrible'], 'Excellent'); print "

Which computer type to you use most for accessing the Internet?
", $query->radio_group( -name=>'computer', -values=>['PC/Clone', 'Unix Platform', 'Mac', 'Other'], -default=>'PC/Clone'); print "

Which Web Browser do you use most frequently?
", $query->radio_group( -name=>'browser', -values=>['Netscape 2.X', 'Netscape 1.X', 'AOL', 'Compuserve', 'Prodigy','Other'], -default=>'Netscape 2.X'); print "

From where do you access the Internet most frequently?
", $query->radio_group( -name=>'from_where', -values=>['Work', 'Home', 'Other'], -default=>'Work'); print "

What connection type do you use to access the Internet most frequently?
", $query->radio_group( -name=>'access', -values=>['Modem/ISP', 'Modem/AOL', 'Modem/Other', 'T1 Line', 'Ethernet', 'Other'], -default=>'Modem/ISP'); print "

Please indicate your age group:
", $query->radio_group( -name=>'age', -values=>['younger than 21', '21 to 30', '31 to 40', '41 to 50', '51 to 65', 'Over 65'], -default=>'21 to 30'); print "

Please indicate your gender:
", $query->radio_group( -name=>'sex', -values=>['Woman', 'Man'], -default=>''); print "

Thank you very much for participating in our survey. Your answers will help us provide better web sites to the Internet Community.

"; print $query->image_button( -name=>'send_button', -src=>$img_button_send, -align=>'LEFT BORDER=0 WIDTH=108 HEIGHT=48 ALT=\"SEND\"'); print $query->image_button( -name=>'clear_button', -src=>$img_button_clear, -align=>'LEFT BORDER=0 WIDTH=108 HEIGHT=48 ALT=\"CLEAR\"'); print "

"; } # ---------- E-mail the form out --------- # One copy gets e-mailed to the address at $MAIL_TO. Another gets mailed to # the address at $query->textfield( 'copy_to' ), if any. Some of the # information that the client enters gets displayed # on the screen so that the remote user knows something happened. sub do_work { local( $query ) = @_; # First check to see if the form is completed correctly if ( $query->param( 'name' ) eq "Needed For A Reply" || $query->param( 'from' ) eq "Needed For A Reply" ) { print "

Oops!!!

Sorry, we need to know more information before we can process your request. Please fill in any field that now contains the words \"Needed For A Reply\" and resubmit your request. Thank You."; &print_prompt( $query ); return; } # Mail one copy to the page's owner. $to = $MAIL_TO; # comment the following two lines to debug open (MAIL, "| $MAIL $MAIL_TO") || die "Mail: $!"; &mail_owner( MAIL, $to, $query ); # &mail_owner( STDOUT, $to, $query ); # uncomment this line to debug close MAIL; # Print another copy to the screen so the user can see # what's going out: print "
The following has been mailed to $MAIL_TO:"; print "
";
     &mail_copy( STDOUT, $to, $query );
     print "
"; print "

"; if ( $query->param( 'copy_to' ) ) { $to = $query->param( 'copy_to' ); print "Copy Sent To: ", $to, "
"; open (MAIL, "| $MAIL $to") || die "Mail: $!"; &mail_copy( MAIL, $to, $query ); close MAIL; } print "
Thanks for your mail and comments. Return to the $OWNER site by tapping the Back button on your web browser.

"; } # # mail_owner. Prints the user feedback reports to the device # passed to it. Works with STDOUT, FILENAME, even MAIL. # Just make sure that the device is open for writing BEFORE # you call printOut. # sub mail_owner { local( $OUTDEV, $to, $query ) = @_; print $OUTDEV "To: $to\n"; print $OUTDEV "From: ", $query->param( 'from' )," (", $query->param( 'name' ), ")"; print $OUTDEV "\nSubject: ", $query->param( 'subject' ), "\n"; print $OUTDEV "X-mail-agent: mail_to.cgi\n"; if ( $query->param( 'copy_to' ) ) { print $OUTDEV "Copy Sent To: ", $query->param( 'copy_to' ); } print $OUTDEV "\n** $OWNER Email Form **\n\n"; print $OUTDEV "*** MESSAGE TEXT FOLLOWS ***\n\n", $query->param( 'letter_text' ), "\n\n"; print $OUTDEV "The organization of page was rated ", $query->param( 'organization' ), ".\n"; print $OUTDEV "The content was rated ", $query->param( 'contents' ), ".\n"; print $OUTDEV "Computer Type was: ", $query->param( 'computer' ), ".\n"; print $OUTDEV "Browser Used was: ", $query->param( 'browser' ), ".\n"; print $OUTDEV "Access Location was: ", $query->param( 'from_where' ), ".\n"; print $OUTDEV "Connection Method was: ", $query->param( 'access' ), ".\n"; print $OUTDEV "Age was: ", $query->param( 'age' ), ".\n"; print $OUTDEV "Gender was: ", $query->param( 'sex' ), ".\n\n"; print $OUTDEV "User's Email Address is: ", $ENV{'HTTP_FROM'}, "\n"; print $OUTDEV "Browser used was: ", $query->user_agent(), "\n"; print $OUTDEV "Calling Host was: ", $query->remote_host(), "\n"; print $OUTDEV "The Name of This Script Is: ", $query->script_name(), "\n"; print $OUTDEV "The Calling Page was: ", $query->param('caller'), "\n\n"; } # # mail_copy. Sends email to the copied address, if provided. # sub mail_copy { local( $OUTDEV, $to, $query ) = @_; print $OUTDEV "To: $to\n"; print $OUTDEV "From: ", $query->param( 'from' )," (", $query->param( 'name' ), ")"; print $OUTDEV "\nSubject: ", $query->param( 'subject' ), "\n"; print $OUTDEV "X-mail-agent: mail_to.cgi\n"; print $OUTDEV "** $OWNER Courtesy Copy **\n\n"; print $OUTDEV "*** MESSAGE TEXT FOLLOWS ***\n\n", $query->param( 'letter_text' ), "\n\n"; print $OUTDEV "The organization of page was rated ", $query->param( 'organization' ), ".\n"; print $OUTDEV "The content was rated ", $query->param( 'contents' ), ".\n"; print $OUTDEV "Computer Type was: ", $query->param( 'computer' ), ".\n"; print $OUTDEV "Browser Used was: ", $query->param( 'browser' ), ".\n"; print $OUTDEV "Access Location was: ", $query->param( 'from_where' ), ".\n"; print $OUTDEV "Connection Method was: ", $query->param( 'access' ), ".\n"; print $OUTDEV "Age was: ", $query->param( 'age' ), ".\n"; print $OUTDEV "Gender was: ", $query->param( 'sex' ), ".\n\n"; } # # clean_up clears starting values of parameters # sub clean_up { local( $query ) = @_; $query->delete('copy_to'); $query->delete('name'); $query->delete('from'); $query->delete('subject'); $query->delete('letter_text'); $query->delete('organization'); $query->delete('contents'); $query->delete('computer'); $query->delete('browser'); $query->delete('from_where'); $query->delete('access'); $query->delete('age'); $query->delete('sex'); } # # print_tail # sub print_tail { local( $filename ) = @_; print "
", "
", "", "
", "
", "", "", "
Back To The $OWNER Home Page...


", "
", "
", "
", "
", "
This page maintained by the ", "", "WEBMASTER@BMWNORCAL.ORG", "
", "All material on this page Copyright © $OWNER, $YEAR.
", "All rights reserved.
", "
", "
"; fileDate( $filename ); }