Solved

Form submittion possible in CGI??

Posted on 2003-12-02
7
456 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
Comment Utility
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
Comment Utility
perhaps try the following http://scripts.cgi101.com/#lk1
0
 
LVL 7

Assisted Solution

by:Xxavier
Xxavier earned 200 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Ducolo
Comment Utility
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
Comment Utility
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
Comment Utility
"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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 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

11 Experts available now in Live!

Get 1:1 Help Now