Solved

Form submittion possible in CGI??

Posted on 2003-12-02
7
461 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft Edge 9 91
Need to convert a simple VB script to PowerShell 3 65
Nmap how to find wich type of socks is this? 4 89
Need a good Angular tutorial 5 70
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now