How To Use formmail.cgi

Applies to :

  • All Linux server


To perform this task, you need to have :

  • Knowledge in accessing the server via FTP.
  • IP address or server hostname.
  • Your server FTP username and password.


formmail.cgi is free script from Matt's Script Archive, Inc. If you post information to formmail.cgi, it will send the information to a specified email address. Please note that formmail.cgi is available only upon request. If you would like to have a copy, please send your request to, stating your domain name. Alternatively, you can also download it at

  • First, you must configure formmail.cgi to work for you.
  • Download formmail.cgi to your local hard disk.
  • Use a text editor to open formmail.cgi to be edited.

    Replace the line ...

    @referers = ('','');
    ... with ...
    @referers = ('www.mydomain_name');

    For example, if your web site is at, then the line is...

    @referers = ('');
    Replace the line ...
    @recipients = &fill_recipients(@referers);
    ... with ....
    @recipients = ('^yourself\@yourdomain\.com');

    For example, if formmail.cgi is suppose to send information to the email address, then the line is...

    @recipients = ('^my_name\@my-company-name\.com');
  • Save the changes, and upload formmail.cgi to your web site.
  • Now that you have configured your formmail.cgi, the next step is to configure your form.

    Your form must post to formmail.cgi. This is done by editing the form tag.

    An example is ....

     <form name="feedback_form" action="./cgi-bin/formmail.cgi" method="post"> 

    The part that you should edit is ...


    The "action" part should point to your formmail.cgi with respect to the location of your form. Your form should include the "recipients" field.

    Your form should include this line within the open and close tags of the form.

     <input name="recipient" value="" type="hidden">

    For example, if the information is supposed to be sent to, then the line will look like...

    <input name="recipient" value="" type="hidden">

If these 2 things are done correctly, your formmail.cgi should work on the whole. There are many other configurations available in formmail.cgi. Please read the README file for more details. (You can download the README file to your local hard disk, then use a text editor to open the README file.)

Please remember to upload your configured formmail.cgi back to the server in ASCII mode, and the set the permissions of formmail.cgi as follows: User: read, write, execute; Group: read, execute; Others: read, execute.

If all of these looks too complicated, fret not! We can help you configure your formmail.cgi and your form! Just email us at, stating your domain name, the full URL path to your form, the email address that the formmail.cgi is suppose to send the information to, the full URL path to the web page that is to be displayed after the end user submits the form.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.