Click here to return to Newclient Main Help Page

formmail.pl

Last Updated: November 14, 1996

  1. Installation
  2. Tips


Installation

To install the formmail.pl script, telnet to your Virtual Server and do the following:

  1. Copy the formmail.pl script located in the /usr/local/contrib area into your cgi-bin:
      % cp /usr/local/contrib/formmail.pl ~/www/cgi-bin
      % chmod 775 ~/www/cgi-bin/formmail.pl
    

  2. Create a form that you would like the contents mailed to some address. The form should include the follwing fields:
      recipient = specifies who mail is sent to
      username = specifies the remote users email address for replies
      realname = specifies the remote users real identity
      subject = specifies what you want the subject of your mail to be

      For example, the HTML source for your form may look like this:

        <form method="POST" action="/cgi-bin/formmail.pl">
        <input type="hidden" name="recipient" value="order@yourdomain.com">
        <input type="hidden" name="subject" value="Order Request">
        Please Enter Your Name:<br>
        <input name="realname" size="40">
        <p>
        Please Enter Your Email Address:<br>
        <input name="username" size="40">
        <p>
        Please Enter The $$$ Amount:<br>
        <input name="amount" size="40">
        <p>
        .
        .
        .
        <input type="submit" value="Submit">
        <input type="reset" value="Reset">
        </form>
      


    Tips

    One way to modify the formmail.pl script is to include an autoresponder that emails the remote client some kind of response. To do this append something like the following to the bottom of the formmail.pl script.
      # open a message to the remote client
      open (MAIL, "|$mailprog $FORM{'username'}") || die "Can't open $mailprog!\n";
      print MAIL "To: $FORM{'username'} ($FORM{'realname'})\n";
      print MAIL "Reply-To: $FORM{'recipient'}\n";
      print MAIL "From: $FORM{'recipient'}\n";
      print MAIL "Subject: $FORM{'subject'}\n\n";
    
      # write out a customized response to the mail message
      print MAIL "We have received your message and are delighted";
      print MAIL "you have chosen to do business with our company.";
      print MAIL "You will find that we are very responsive and will";
      print MAIL "get back with you shortly.  Have a great day!";
    
      # close the message
      close (MAIL);
    

    bd