#!/usr/bin/perl # ex: set ai shiftwidth=4 tabstop=4 expandtab: use strict; use CGI qw(:standard :html3 *b *table *font); ################# Globals ################# # MAILER: depending on your system, you'll need to find your # sendmail program. my $mailer = '/usr/sbin/sendmail -t'; # Enter a real address to send email to my $mail_to = 'null@my.domain'; # Enter a real address to send email from. Yahoo! requires that this is # a valid Yahoo! email account. my $mail_from = 'null@my.domain'; # enter some image URLs. You'll have to provide the images. my $banner_img = '/images/header.jpg'; my $footer_img = '/images/footer.gif'; my $banner_txt = 'My Cool Domain!'; my $sitetitle = 'Web Browser Title Text!'; ################ END GLOBALS ################# # but not really since we don't use sub-routines, ha. # Collect parameters my $query = new CGI; my $Subject = $query->param('Subject'); my $ReplyTo = $query->param('ReplyTo'); my $Message = $query->param('Message'); my $PhoneNo = $query->param('PhoneNo'); my $FullName = $query->param('FullName'); my $UserName = $query->param('UserName'); my $StreetAddress = $query->param('StreetAddress'); print $query->header(), start_html( -title=>$sitetitle, -bgcolor=>'#ffffff', -leftmargin=>'0', -topmargin=>'0', -rightmargin=>'0', -bottommargin=>'0', -marginheight=>'0', -marginwidth=>'0', -text=>'#000000', -vlink=>'darkgreen', -link=>'green', -alink=>'red'),"\n\n", font({-face=>"arial, helvetica, sans-serif", -size=>"-1"}),"\n", p({-align=>'center'}),"\n\n"; print $query->start_table({ -border=>'0', -width=>'100%', -cellpadding=>'10', -cellspacing=>'0'} ),"\n"; # Add banner with link to home page print $query->Tr({-valign=>'top'}, td({-align=>'left',-colspan=>'2', -background=>$banner_img,-height=>'115',-valign=>'bottom', -style=>'font-color: #fffefe; size: 30px;'}, a({-href=>'/',-target=>'_top', -style=>'font-family: arial; font-size: 30px; color: #ddffdd;'}, $banner_txt ) ) ); if (defined($Subject) && defined($ReplyTo) && defined($Message)) { # mail the message open(MAIL, "| $mailer") or die "Can't open: $!\n"; print MAIL "To: $mail_to\n"; print MAIL "Cc: $ReplyTo\n"; print MAIL "From: $mail_from\n"; print MAIL "Reply-To: $ReplyTo\n"; print MAIL "Subject: $Subject\n\n"; $Message = "\n$Message\n"; if (length($UserName) > 0) {$Message = "Forum UserName: $UserName\n" . $Message;} if (length($PhoneNo) > 0) {$Message = "Phone Number: $PhoneNo\n" . $Message;} if (length($StreetAddress) > 0) {$Message = "Address: $StreetAddress\n" . $Message;} if (length($FullName) > 0) {$Message = "$FullName writes the following:\n" . $Message;} print MAIL $Message; close(MAIL); # indicate we're sending the message and show what we're sending. $Message =~ s/\n/
/g; print $query->Tr({-style=>'font-family: arial; size: 9pt;', -valign=>'top'}, td({-align=>'left',-colspan=>'2'}, "Mailing your message as follows...", p({-align=>'center'}), "\n", table({-border=>'0',-cellpadding=>'4',-cellspacing=>'0'}, "\n", Tr({-style=>'font-family: arial; size: 9pt;', -valign=>'top'}, [ td({-align=>'left'},["Subject:","$Subject"]), td({-align=>'left'}, ["Your Email:","$ReplyTo"]), td({-align=>'left'},["Message:","$Message"]), td({-align=>'left', -colspan=>'2'}, p("Thank you very much for your comments. We will try to get back to you within one week.")) ] ) ) ) ), "\n\n"; } else { # Create form with values if any print $query->Tr({-valign=>'top'}, td({-align=>'center',-colspan=>'2'}, table({-border=>'0',-cellpadding=>'4',-cellspacing=>'0'},"\n", start_form(),"\n", Tr({-style=>'font-family: arial; size: 9pt;', -valign=>'center'}, [ td({-align=>'left', -colspan=>'2'}, p("Please use this simple form to initiate all communication with $banner_txt. If you make it clear what you want, we'll make sure it gets to the right person.") ), td({-align=>'left'}, ["Your Name:", textfield({-style=>'font-family: arial; size: 9pt;', -size=>"60", -maxlength=>"100", -name=>"FullName", -value=>$FullName}) ]), td({-align=>'left'}, ["Your Email Address:", textfield({-style=>'font-family: arial; size: 9pt;', -size=>"60", -maxlength=>"255", -name=>"ReplyTo", -value=>"$ReplyTo"}) ]), td({-align=>'left'}, ["Your Phone Number:", textfield({-style=>'font-family: arial; size: 9pt;', -size=>"60", -maxlength=>"16", -name=>"PhoneNo", -value=>"$PhoneNo"}) ]), td({-align=>'left'}, ["Forum Username:", textfield({-style=>'font-family: arial; size: 9pt;', -size=>"60", -maxlength=>"100", -name=>"UserName", -value=>"$UserName"}) ]), td({-align=>'left'}, ["Street Address:", textfield({-style=>'font-family: arial; size: 9pt;', -size=>"60", -maxlength=>"100", -name=>"StreetAddress", -value=>"$StreetAddress"}) ]), td({-align=>'left'}, ["Subject:", textfield({-style=>'font-family: arial; size: 9pt;', -size=>"60", -maxlength=>"100", -name=>"Subject", -value=>"$Subject"}) ]), td({-align=>'left', -valign=>'top'}, ["Message:", textarea({-style=>'font-family: arial; size: 9pt;', -cols=>"58", -rows=>"8", -name=>"Message", -value=>"$Message"}) ]), td({-align=>'left'}, [" ", submit({-value=>"Send Message"}) ]) ]),"\n", end_form() ) )),"\n\n"; } # Add the footer link and wrap it up. print $query->Tr({-align=>'center',-valign=>'top'}, td({-align=>'center',-colspan=>'2', -background=>$footer_img,-height=>'115'}) ), end_table(),"\n", br(),"\n\n", end_font(),end_html(),"\n\n"; exit;