Can you help me with the attached formmail code please

Discussion in 'Programming' started by Deemac, Oct 5, 2008.

  1. #1
    Can you help me with the attached formmail code please.

    I have tried but this is just not mailing the info back to me.

    The objective is to receive the customers name and telephone number and once they have submitted the info and pressed enter to be re-directed back the the index page (and have the info e-mailed to my address).

    I have placed the code below from the HTML page.

    I have also set permissions to 755.

    Thanks in advance for your help.

    <form class="webform" action="http://www.mywebsite.co.uk/cgi-
    bin/formmail/iopost.pl" method="post">
    <input type="hidden" name="recipient" value="info@mywebsite.co.uk" />
    <input type="hidden" name="subject" value="***Information Request***"
    />
    <input type="hidden" name="redirect" value="http://www.mywebsite.co.
    uk/index.html" />
    <input type="hidden" name="env_report" value="REMOTE_HOST,
    HTTP_USER_AGENT" />
    <label>Name please:</label>
    <br />
    <input name="name" class="formname" type="text" size="31" maxlength="
    50" />
    <div id="spacer">&nbsp;</div>
    <label>Telephone number please:</label><br />
    <input name="telnumber" class="formnumber" type="text" size="31"
    maxlength="50" />
    <div id="spacer">&nbsp;</div>
    <input name="enter" type="button" value="enter" />
    </form>
     
    Deemac, Oct 5, 2008 IP
  2. Fracisc

    Fracisc Well-Known Member

    Messages:
    3,670
    Likes Received:
    10
    Best Answers:
    1
    Trophy Points:
    195
    #2
    I am not good with cgi but I can code a send mail in php. PM me if you need that.
     
    Fracisc, Oct 5, 2008 IP
  3. Deemac

    Deemac Peon

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Fracisc.

    If it helps first, for any others reading, I have placed the Formmail script and the HTML. If anyone can fathom out why the info is not being returned I would appreciate.

    The only obvious point I can see is I only have my e-mail address in the HTML script and not the Formmail script but I'm not sure where it goes.

    As always I would appreciate any advice.

    formmail script

    #!/usr/bin/perl
    ##############################################################################
    # FormMail Version 1.92 #
    # Copyright 1995-2002 Matt Wright #
    # Created 06/09/95 Last Modified 04/21/02 #
    # Matt's Script Archive, Inc.: http://www.scriptarchive.com/ #
    ##############################################################################
    # COPYRIGHT NOTICE #
    # Copyright 1995-2002 Matthew M. Wright All Rights Reserved. #
    # #
    # FormMail may be used and modified free of charge by anyone so long as this #
    # copyright notice and the comments above remain intact. By using this #
    # code you agree to indemnify Matthew M. Wright from any liability that #
    # might arise from its use. #
    # #
    # Selling the code for this program without prior written consent is #
    # expressly forbidden. In other words, please ask first before you try and #
    # make money off of my program. #
    # #
    # Obtain permission before redistributing this software over the Internet or #
    # in any other medium. In all cases copyright and header must remain intact. #
    ##############################################################################
    # ACCESS CONTROL FIX: Peter D. Thompson Yezek #
    # http://www.securityfocus.com/archive/1/62033 #
    ##############################################################################
    # Define Variables #
    # Detailed Information Found In README File. #

    # $mailprog defines the location of your sendmail program on your unix #
    # system. The flags -i and -t should be passed to sendmail in order to #
    # have it ignore single dots on a line and to read message for recipients #

    $mailprog = '/usr/lib/sendmail -i -t';

    # @referers allows forms to be located only on servers which are defined #
    # in this field. This security fix from the last version which allowed #
    # anyone on any server to use your FormMail script on their web site. #

    @referers = ('mywebsite.co.uk','localhost');

    # @recipients defines the e-mail addresses or domain names that e-mail can #
    # be sent to. This must be filled in correctly to prevent SPAM and allow #
    # valid addresses to receive e-mail. Read the documentation to find out how #
    # this variable works!!! It is EXTREMELY IMPORTANT. #
    @recipients = &fill_recipients('mywebsite.co.uk');

    # ACCESS CONTROL FIX: Peter D. Thompson Yezek #
    # @valid_ENV allows the sysadmin to define what environment variables can #
    # be reported via the env_report directive. This was implemented to fix #
    # the problem reported at http://www.securityfocus.com/bid/1187 #

    @valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_USER_AGENT');

    # Done #


    html form script

    <form class="webform" action="http://www.mywebsite.co.uk/cgi-bin/formmail/iopost.pl" method="post">
    <input type="hidden" name="recipient" value="info@mywebsite.co.uk" />
    <input type="hidden" name="subject" value="***Information Request***" />
    <input type="hidden" name="redirect" value="http://www.mywebsite.co.uk/index.html" />
    <input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT" />
    <label>Name please:</label>
    <br />
    <input name="name" class="formname" type="text" size="31" maxlength="50" />
    <div id="spacer">&nbsp;</div>
    <label>Telephone number please:</label><br />

    <input name="telnumber" class="formnumber" type="text" size="31" maxlength="50" />
    <div id="spacer">&nbsp;</div>
    <input name="enter" type="button" value="enter" />
    </form>
     
    Deemac, Oct 6, 2008 IP