Jump to content
xisto Community
BuffaloHelp

How To Use Trap17 Cgi Formmail a built-in script in every hosting

Recommended Posts

This tutorial is using Xisto hosting's built-in script called cgiemail. There are several hundreds of free scripts you can download and install it yourself but why not use what is already provided for you, if all you need is a simple submit and data collection?

 

Let's begin. There are three things you need to remember: 1) you can rename the file however you'd like 2) two files (which I'll name them submitForm.html and template.txt) must be in the same directory 3) first two lines in template.txt must EXIST.

 

Write your submitForm.html (where you write a HTML page to let a visitor enter your desired information) and include the following (an example)

<form method="POST" action="http://name.trap17.com/cgi-bin/cgiemail/directory/template.txt" name="myform" >
<input type="hidden" name="addendum" value="Thank you. If you are seeing this page, you should be contacted within 48 hours.">
<table border=0 cellspacing=0 celpadding=0>    
<tr>
<td colspan=2>Enter your information:<br>
</td>
</tr>
<tr>
<td><p align=right>
First Name:</td>
<td>
<input type="text" name="FirstName" size=25 maxlength=50>
<td>
</tr>
<tr>
<td><p align=right>
Last Name:</td>
<td>
<input type="text" name="LastName" size=25 maxlength=50>
</td>
</tr>    
<tr>
<td><p align=right>
Zip Code:</td>
<td>
<input type="text" name="zip" size=25 maxlength=50>
</td>
</tr>
<tr>
<td><p align=right>
Email:</td>
<td>
<input type="text" name="email" size=25 maxlength=50>
</td>
</tr>
<tr>
<td><p align=right>
Phone:</td>
<td>
<input type="text" name="area" size=4 maxlength=5>-
<input type="text" name="exchange" size=4 maxlength=3>-
<input type="text" name="number" size=5 maxlength=4>
</td>
</tr>

----------

Edit: Thank you midnightvamp. I have completely forgotten the most important code for sending. Please don't forget to include this at the bottom of your form code

To add a submit button to the form (so the people can send it once it's filled out), you would type this at the bottom...

 

<INPUT TYPE="submit" value="Send">

You might also want a 'reset' button:

 

<INPUT TYPE="reset" value="Reset">

And I believe that you must add a line to end the code for the form too at the bottom:

 

</form>
The discussion is also continued here http://forums.xisto.com/topic/26673-seting-up-form-mail-help/

----------

 

It is not important how this HTML is written but that name="value" is assigned as you would like. Method must be ="POST"and ACTION="http...yoursite.trap17.com/cgi-bin/cgiemail/directory/template.txt" directory is optional, you can have this in your root or under another subfolder. Watch the template.txt spelling and they are case sensitive.

 

Now write your template.txt as follows

To: your-receiving-address@server.comSubject: testing out the application formName entered:	[FirstName] [LastName]Zip code:	[zip]Sender's email:	[email]Sender's phone:	([area])[exchange]-[number]
The first two lines are MUST! The way this cgiemail was written it looks for the first two lines for the execution. You can change them however you see fit but they must have To: and Subject: as listed above. And as you can see, I have my TXT file tab and spaced out as I'd like to see the final result.

 

When you test out the form you will receive, either as attached TXT file or as a body of a letter (my yahoo account shows me both)

Name entered:	Buffalo HELPZip code:	90210Sender's email:	sender's@entered.emailSender's phone:	(714)555-1212
When you receive this submitted data, you'll noticed that it's from some unknown email address (I won't type it here since it's against posting someone else's email address). That address is from the creator of this cgiemail file. That's why I have the visitor enter his/her address so that I have a record of the reply. It's not perfect but it works beautifully.

 

I'll be sure to site the original source once I find the link again (I forgot where I put that thing)

 

Cross post with question: http://forums.xisto.com/topic/25623-help-with-reading-files-read-and-replaceinsert-data-from-form/

 

Edit: Found the original source located in cPanel CGI center > CGI Email

http://web.mit.edu/wwwdev/cgiemail/user.html

http://forums.xisto.com/no_longer_exists/

Edited by BuffaloHELP (see edit history)

Share this post


Link to post
Share on other sites

Forgot to explain this line:

<input type="hidden" name="addendum" value="Thank you. If you are seeing this page, you should be contacted within 48 hours.">

When you have this HTML, after a visitor submits the form the next page or redirect page will display the message, Thank you. If you are seeing this page, you should be contacted within 48 hours. If you know how to manipulate you can also have it redirect it to some other page with time delay. The possibilities are endless.

Share this post


Link to post
Share on other sites

Good tutorial. I figured I would ask here before anywhere else.What exactly is CGI and what is it used for? I have seen it around alot but I have never used it beacuse of not knowing what it was.If someone could just tell me what it is in here, give me a link to a good site about it, or even make a tutorial about it, I would be very grateful.Anyway, good tut.

Share this post


Link to post
Share on other sites

What exactly is CGI and what is it used for? I have seen it around alot but I have never used it beacuse of not knowing what it was.

170639[/snapback]


Sorry to be off topic but CGI stands for

The common gateway interface (CGI) is a standard way for a Web server to pass a Web user's request to an application program and to receive data back to forward to the user. When the user requests a Web page (for example, by clicking on a highlighted word or entering a Web site address), the server sends back the requested page. However, when a user fills out a form on a Web page and sends it in, it usually needs to be processed by an application program. The Web server typically passes the form information to a small application program that processes the data and may send back a confirmation message. This method or convention for passing data back and forth between the server and the application is called the common gateway interface (CGI). It is part of the Web's Hypertext Transfer Protocol (HTTP).

 

If you are creating a Web site and want a CGI application to get control, you specify the name of the application in the uniform resource locator (URL) that you code in an HTML file. This URL can be specified as part of the FORMS tags if you are creating a form.


Go to google.com and type in the search field

define:cgi

and look for this related meaning and links for Common Gateway Interface.

 

Edit: For those who are looking to use this preinstalled script and have had trouble getting it to work, please check this thread http://forums.xisto.com/topic/26673-seting-up-form-mail-help/ Thank you ;)

Edited by BuffaloHELP (see edit history)

Share this post


Link to post
Share on other sites

This is great, but I have a site that doesn't have cgiemail. Is there a way to hook up an html code with cgi to make it so it will send info to you without having the person to use their own email?This way I could have people send their comments to me without having to use their email, but a comment area.

Share this post


Link to post
Share on other sites

CGI formmail requires you to have CGI capability. If the server (other than TRAP) can run PHP here's another link http://forums.xisto.com/topic/20516-email-scriptform-with-php-how-to-make-a-simple-email-script-using-php/ (by the way, snlildude87 also wrote another tutorial but I can't find it at this time)

A simple html data retrieval can be expressed as

<INPUT TYPE="submit" value="Send">


and all you have to do is place an appropriate text field input argument before this one. You can search for free html formmail generator. I have found some in the past but since I'm now hosted with TRAP, I gave all that up.

PS, the sender's email address is absolutely optional. I made my example to include that factor to cover the general knowledge of what cgiemail can do.

Share this post


Link to post
Share on other sites

Thanks Buffalo. I wish I could have developed my own script and stuff. But in order for the user to not have to use their own email account, I guess I will be looking at some free form generators. Thanks for your help again. I will be sure to check out all the possibilities. See you around.

Share this post


Link to post
Share on other sites

oh man.. I REALLy REALLY needed that.. And I totally though CGI meant computer generated images. lol. Does this mail form send if there are missing information

Share this post


Link to post
Share on other sites

Yes. In fact I added a script that it will not send if the information I want isn't included from the sender. I added another script so that the email address is correctly entered, such as name@address.extension. The possibilities are endless. :)

Share this post


Link to post
Share on other sites

Personally, I see it as a dumbed down version of PHP, for handling forms and advanced functions (however not as powerful as PHP)

 

Panda

171545[/snapback]


False. CGI may be as good as PHP - or even better.

Form mail is just like a "script" to make it easier to use CGI's mail functions.

Share this post


Link to post
Share on other sites

It's a cool way to receive email, but i prefer using flash and php, cause i really hate cgi and perl. Cgi is a high vulnereble language, beleave me.There are programs like cgi scan and tons of others that scan websites/scripts whatever in cgi that is hosted in some web server to get in with admin account, that's what hackers use for cgi website (not only).Thanks, anyway.

Share this post


Link to post
Share on other sites

Thanks for the time taken to write this tutorial on how to use the cgi mail form function. I may use this in the near future.Up til know I've been using the php mail script as it's been a language i'm used to writing in. There is an incredible amount of functionality existant in the php language.I might try this later. It sounds like it's easy to configure/install and that not a lot of time is needed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.