Thanks everyone for your input :)

The script works great now, but as per merlyn's request, I am not deploying this script until everyone is happy :)))) It is online, but there are no links to it, except the one on here.

Here is the final script:

#!/usr/bin/perl -wT ################################ ################################ ### ### ### written by Rob Johnson ### ### www.robj.ca ### ### tellscript@robj.ca ### ### ### ################################ ################################ use CGI::Carp qw(fatalsToBrowser); use strict; use CGI ':standard'; # fixes the error with -t switch in mailprogram line? # hey I don't know... but it works! :) $ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin"; my $redirect = "http://www.robj.ca/told.htm"; my $sitename = "robj.ca"; my $siteurl = "http://www.robj.ca"; my $from = param('from'); my $to = param('to'); my $frommail = param('frommail'); my $tomail = param('tomail'); my $message = param('message'); ############################################### # make all first characters of names, uppercase my @from = split(/ /, $from); @from = map ucfirst, @from; my @to = split(/ /, $to); @to = map ucfirst, @to; ############################################### # make the first letter of the message upper case $message = ucfirst($message); ############################################## # puts a period at the end of senders message, # if one was not there, AND, if there is no # question OR explanation mark. $message .= '.' if $message !~ /[.!?]$/; ############################################## # sending mail now... open (MAIL, "|/usr/sbin/sendmail -t") || Error ('open', 'mail program' +); print MAIL "From: $frommail\n"; print MAIL "To: $tomail\n"; print MAIL "Subject: @to, @from says check out $sitename!\n\n"; print MAIL "This is NOT spam! You were sent the email by @from ($fro +mmail),\nat IP: $ENV{'REMOTE_ADDR'}\n\n\n"; print MAIL "Hello @to, @from has sent you this email inviting you to + check out $siteurl\n\n\n"; print MAIL "@from also had this to say:\n$message\n\n\n" if ($messag +e ne ""); print MAIL "So check out $siteurl!"; close (MAIL); sub Error { print "The server can't $_[0] the $_[1]: $! \n"; exit; } # ready browser for html output print "Content-type: text/html\n\n"; # redirect the browser... print "<meta http-equiv=\"refresh\" content=\"0;url=$redirect\">"; # end

How can this script be made safe agaist people who would want to exploit it?
Would it take much more work?


In reply to Re: making first letter of all words in array upper case by Anonymous Monk
in thread making first letter of all words in array upper case by iamrobj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.