Solved

Form submittion possible in CGI??

Posted on 2003-12-02
7
469 Views
Last Modified: 2013-12-25
I've got a question (duh!) about CGI. I have a <FORM> on my website,but instead of submit button doing this: mailto:adres@email.com, I wonder if it is possible to send the info to an email adres, without having to really send the email (opening outlook express). For example: you press the button "submit" and the next screen says: Information sent! Is this possible in CGI?
0
Comment
Question by:Ducolo
7 Comments
 
LVL 3

Assisted Solution

by:mrh30
mrh30 earned 100 total points
ID: 9860005
It's certainly possible.  In Perl you can use the MIME::Lite module to generate the appropriate headers within the CGI script and then automatically perform the mail.

Information about MIME::Lite is at http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm which includes examples of usage.  Basically you'll need to create appropriate headers for a plain text e-mail, then attach a portion of text (this can obviously be a string), and send the email out.  The CGI script can then proceed to the 'Information Sent' page.
0
 

Assisted Solution

by:Richoo
Richoo earned 100 total points
ID: 9860310
perhaps try the following http://scripts.cgi101.com/#lk1
0
 
LVL 7

Assisted Solution

by:Xxavier
Xxavier earned 200 total points
ID: 9862241
This looks like a client side problem, this will alert the user an e-mail is being sent but will not open outlook etc.

<form method="post" action="mailto:XYZ@abc.com?subject=Visitor Comments"
enctype="text/plain">
  <p><input type="text" name="Field1" size="20"><br>
  <input type="text" name="Field2" size="20"><br>
  <input type="text" name="Field3" size="20"><br>
   <select name="Field6" size="1">
      <option>Option1</option>
      <option>Option2</option>
      <option>Option2</option>
  </select><br>
  <input type="submit" value="Submit"> </p>
</form>


thre may be something of interest here for you as well

http://www.scriptarchive.com/formmail.html 
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Ducolo
ID: 9865041
I tried this in MIME:
--------
$msg = MIME::Lite->new(
             From     =>'ducorisselada@hotmail.com',
             To       =>'ducolo1979@hotmail.com',
             Subject  =>'Antwoordformulier autoverzekeringen',
             Type     =>'multipart/related'
             );
$msg->attach(Type => 'text/html',
             Data => qq{ <body>
                                                   Informatie die wordt meegegeven
                                                 </body> }
             );
$msg->send();
-------------

It does not work, wich is assumingly. Where do i put this script in my HTML?? Let's say i got this HTML:
-------
<form>
  <p><input type="text" name="Field1" size="20"><br>
  <input type="text" name="Field2" size="20"><br>
  <input type="text" name="Field3" size="20"><br>
   <select name="Field6" size="1">
      <option>Option1</option>
      <option>Option2</option>
      <option>Option2</option>
  </select><br>
  <input type="submit" value="Submit"> </p>
</form>
------

I wil wait for further answers. Xxavier, ur solution works, but if you don't have an outlook adres (or outlook), it won't work. So therefore I will try something else. Will it not work, I will use your answer.

0
 

Author Comment

by:Ducolo
ID: 9880891
I changed my mind. I will use CGI. I dowloaded :FormMail.cgi from Mat's Script Archive. You save this file in a /cg-bin/ map,is that right? And the form should read: <form action="/cgi-bin/FormMail.cgi"> </form>

There are also 3 variables you have to change.

- $mailprog = 'usr/lib/sendmail -i -t'
This is the location to your server's sendmail programme. How do i know what this is? Askmy provider?

The rest i know how to solve.
0
 
LVL 7

Assisted Solution

by:Xxavier
Xxavier earned 200 total points
ID: 9887298
"This is the location to your server's sendmail programme. How do i know what this is? Askmy provider?"

Basically yes, that is the way to do it. Xx
0
 
LVL 48

Accepted Solution

by:
Tintin earned 100 total points
ID: 9889709
Please DO NOT use Matt's formmail.  It is insecure, poorly written and not maintained.

Use the 100% compatible, secure, well written and maintained Formmail version from http://nms-cgi.sourceforge.net/
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to picture file 3 80
Example unit tests with AngularJS 3 47
.php tree directory? 5 83
AWK Code gives empty file, why? 12 36
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question