#!/usr/bin/perl # # This script generates a form to send mail. use strict; use CGI; my $q = new CGI; my $refering_page = $q->http('referer'); # # Note: depending on the refering page, we want this page to look # different. Ergo these variables. # my $text_bg = '#FFFFFF'; my $text_fg = '#000000'; my $a_link_text = '#0000FF'; my $v_link_text = '#800080'; my $link_text = '#0000FF'; my $font_string = ''; if ($refering_page =~ /naveen/) { $text_bg = '#222222'; $text_fg = '#aaaaaa'; $a_link_text = '#cccccc'; $v_link_text = '#aaaaaa'; $link_text = '#eeddba'; $font_string = ''; } if ( ($refering_page =~ /zulfi\.mit\.edu/) || ($refering_page =~ /bhalu\.com/) ) { print $q->header(), $q->start_html(-title=>'Send mail', -BGCOLOR=>"$text_bg", -TEXT=>"$text_fg", -ALINK=>"$a_link_text", -VLINK=>"$v_link_text", -LINK=>"$link_text"), "${font_string}

Send mail to Naveen

\n\n
\n\n", "${font_string}(Click here to see why I use a form instead of a \"mailto\" link.)\n

\n", $q->startform('POST', '/cgi-bin/mailform.pl', 'application/x-www-form-urlencoded'), $q->hidden(-name=>'refering_page', -default=>"$refering_page"), "\n", "\n\n\n\n\n\n\n\n\n\n\n\n
${font_string}Your name:", $q->textfield(-name=>'username', -default=>'', -size=>30, -maxlength=>80), "
${font_string}Your email:", $q->textfield(-name=>'from_email', -default=>'', -size=>30, -maxlength=>80), "
${font_string}Subject:", $q->textfield(-name=>'subject', -default=>'', -size=>50, -maxlength=>150), "
\n

${font_string}Text:
", $q->textarea(-name=>'comment', -default=>'', -rows=>15, -cols=>60), "

\n
\n", $q->submit(-name=>'Mail your Comments'), $q->reset, $q->endform, "

\n\n


\n

", $q->end_html; } else { # If we came here means we came to this page from some other website, # or someone just types the URL for this page into their browser. In # that case we don't bother sending the email and shoo them away. print $q->header(), $q->start_html(-title=>'Go away'), "

Go away

\n\n", $q->end_html; }