How do I make my form a Form-to-Email?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tracker3000
    New Member
    • Dec 2005
    • 5

    How do I make my form a Form-to-Email?

    Hi, i've been to your website a few times before and I really like it, and thought you might be able to help.

    I'm building a website for a friend, and he wants a resume form (about 10-15 fields, all text entry boxes) to be sent to his email when the user hits Submit, i've looked and looked and just cant figure out how to do this. I've seen what I think are programs some sites are selling to do it, or remote websites that will do it for you, but I wanted to come here first to see if I could get this done myself.

    I apprichiate any help you guys have,

    Thanks
  • skyhawk133
    New Member
    • Dec 2005
    • 3

    #2
    Depending on what software you have available to you (PHP, ASP, Perl, etc.) You should be able to find FormMail in Perl or PHP.

    FormMail is nice because you simply submit the form to the formmail.php file and it automatically sends the email.

    Here is the PHP FormMail script I personally use: http://hotscripts.com/Detailed/29699.html

    Comment

    • Tracker3000
      New Member
      • Dec 2005
      • 5

      #3
      Ok

      Ok, so i'd have to buy that program before I can get my form to send submits to my email?

      Are there any free options when trying to get form to emails set up?

      Thanks

      Comment

      • Niheel
        Recognized Expert Moderator Top Contributor
        • Jul 2005
        • 2433

        #4


        Scroll to the bottom, you can download it for from from the company's website.

        Enjoy!
        niheel @ bytes

        Comment

        • skyhawk133
          New Member
          • Dec 2005
          • 3

          #5
          You can also download a free version here: http://www.dtheatre.com/scripts/formmail.php

          That's the exact one I've used in the past. Works like a charm.

          Comment

          • Tracker3000
            New Member
            • Dec 2005
            • 5

            #6
            Hrmm

            Well, i've downloaded both those links you guys gave me, but now im lost :|

            When i try to open then they try and open like a picture and nothing comes up, and i've read I have to install them on my server? How/what is that, and once thats done, how do I code it into my form to send it to my email?

            Thanks!

            Comment

            • kamill
              New Member
              • Dec 2006
              • 71

              #7
              i have a solution for you......
              you can send an email with hitting on submit buttoon.....


              you have to require write code something like that..
              values getted from your form
              [PHP]$name=$_POST['name'];
              $companynm=$_PO ST['companynm'];
              $companyph=$_PO ST['companyph'];
              $fax=$_POST['fax'];
              $email=$_POST['email'];
              $city=$_POST['city'];
              $subject="Mail from Site..";
              [/PHP]
              mail id where you want to send mail
              [PHP] $adminmail = "info@yourdomai nnnn.com";[/PHP]
              mail's msg in tabular format
              [PHP] $msg ="<table border=1 width=\"100%\" cellspacing=0 cellpadding=7 bordercolor=\"# cccccc\">";
              $msg .= "<tr height=27><td width=150 bgcolor=\"#eeee ee\" valign=middle>< font face=verdana size=2> ";
              $msg .= "Date </td><td><font face=verdana size=2 color=\"#666666 \">$dat</td></tr>";


              $msg .= "<tr height=27><td width=150 bgcolor=\"#eeee ee\" valign=middle>< font face=verdana size=2> ";
              $msg .= "Name </td><td><font face=verdana size=2 color=\"#666666 \">$name</td></tr>";

              $msg .= "<tr height=27><td bgcolor=\"#eeee ee\" valign=middle>< font face=verdana size=2> ";
              $msg .= "Email </td><td><font face=verdana size=2 color=\"#666666 \">$from</td></tr>";

              $msg .= "<tr height=27><td bgcolor=\"#eeee ee\" valign=middle>< font face=verdana size=2> ";
              $msg .= "Company Name </td><td><font face=verdana size=2 color=\"#666666 \">$companyn m</td>";

              $msg .= "</tr></table>";
              $from = "$name<$fro m>";

              [/PHP]
              define header
              [PHP] $headers = "Content-type: text/html; charset=iso-8859-1\r\n";
              [/PHP]
              set SMTP
              [PHP] ini_set("SMTP", "info.yourdomai nnn.com");
              [/PHP]
              then last...........
              [PHP] mail($email, $subject, $msg, "From:$from\n". $headers);[/PHP]

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                A nice example by Zakir Hossain:
                Name=Easy Form Mailer
                Version=1.5
                Date= November 14, 2006
                Developer=Md. Zakir Hossain (Raju)
                Email=rajuru(at )gmail(dot)com
                URL=http://www.rajuru.xene xbd.com
                License: LGPL

                File SAMPLE.PHP
                [html]
                <html>
                <head>
                <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
                <meta http-equiv="Content-Language" content="en-us">
                <title>Form Submission</title>
                </head>
                <body>
                <hr>
                <form action="mailer. php" method="POST" enctype="multip art/form-data">
                <h2>Form Submission Sample</h2>
                <p>Make up a username:<br>
                <input type="text" size="25" maxlength="256" name="__Usernam e"> -- <em>you
                can use mixed case</em><br>
                Make up a password:<br>
                <input type="password" size="25" maxlength="256" name="__Passwor d"> -- <em>
                help keep this private!</em><br>
                Enter password again:<strong>< br>
                </strong>
                <input type="password" size="25" maxlength="256" name="__Passwor dVerify"> --
                <em>for verification</em><br>
                Enter e-mail address:<strong ><br>
                </strong><input type="text" size="25" maxlength="256" name="__EmailAd dress">
                -- <em>if you have one</em></p>
                <p><input type="text" size="25" maxlength="256" name="Firstname "> - First
                Name</p>
                <p><input type="text" size="25" maxlength="256" name="Lastname" > - Last Name</p>
                <h2><input type="submit" value="Register Me">
                <input type="reset" value="Clear Form"></h2>
                <input type="hidden" name="Email_Rec ipient" value="rajuru@g mail.com">
                <input type="hidden" name="Email_Sen der" value="test@gma il.com">
                <input type="hidden" name="Email_Sub ject" value="Membersh ip Request">
                <input type="hidden" name="Email_Suc cess" value="Request Submitted, thanks for your time">
                <input type="hidden" name="Email_Fai lure" value="An unknown error occured while submitting your form.">
                <input type="hidden" name="Return_Ur l" value="<?php echo $_SERVER['HTTP_REFERER'];?>">
                </form>
                <hr>
                </body>
                </html>
                [/html]
                FILE MAILER.PHP:
                [php]
                <?php
                /*
                Name=Easy Form Mailer
                Version=1.5
                Date= November 14, 2006
                Developer=Md. Zakir Hossain (Raju)
                Email=rajuru(at )gmail(dot)com
                URL=http://www.rajuru.xene xbd.com
                License: LGPL
                I appreciate the email's last credit line but not mandatory. A thank is highly deserved
                */
                print_r($_POST) ;

                //check for 3 required fields, these fields are made with Case-sensitivity
                if(empty($_POST['Email_Recipien t'])) die("No Email Recipient");
                if(empty($_POST['Email_Sender'])) die("No Email Sender");
                if(empty($_POST['Email_Subject'])) die("No Email Subject");

                $to=$_POST['Email_Recipien t'];
                $from=$_POST['Email_Sender'];
                $subject=$_POST['Email_Subject'];
                unset($_POST['Email_Recipien t']);
                unset($_POST['Email_Sender']);
                unset($_POST['Email_Subject']);


                //success message, you can define one with hidden field. hidden field name must be "Email_Succ ess"
                if(!empty($_POS T['Email_Success'])) {
                $success=$_POST['Email_Success'];
                } else {
                $success= "Form submitted Successfully";
                }
                unset($_POST['Email_Success']); //unset this variable

                //Failure message, you can define one with hidden field. hidden field name must be "Email_Fail ure"
                if(!empty($_POS T['Email_Failure'])){
                $failure=$_POST['Email_Failure'];
                } else {
                $failure="Form submission failed. Sorry for this inconvenience";
                }
                unset($_POST['Email_Failure']); //unset this variable

                //set return url after successfully completing submission
                if(!empty($_POS T['Return_Url'])){
                $returnurl=$_PO ST['Return_Url'];
                } else {
                $returnurl=$_SE RVER['HTTP_REFERER'];
                }
                unset($_POST['Return_Url']); //unset return url

                $msg="";

                foreach ($_POST as $Field=>$Value) {
                if(substr($Fiel d,0,2)=="__"){ //field started with double underscore which means they are required fields
                if(empty($Value )){
                die("You must enter ".substr($Field ,2)."<br/><a href=\"javascri pt:history.go(-1)\">Go Back</a>"); //cancel script
                } else {
                $msg .= substr($Field,2 ) .": <b>". $Value."</b>"; //strip first two character as they are double underscore
                $msg .="<br>";
                }
                } else {
                $msg .= $Field .": <b>". $Value."</b>";
                $msg .="<br>";
                }
                }
                $msg.= "<br/><br/>Script by <a href=\"http://www.rajuru.xene xbd.com\">Md. Zakir Hossain (Raju)</a>";
                /* To send HTML mail, you can set the Content-type header. */
                $headers = "MIME-Version: 1.0\r\n";
                $headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
                /* additional headers */
                $headers .= "To: $to \r\n";
                $headers .= "From: $from \r\n";
                $headers .= "Subject: $subject \r\n";

                /* and now mail it */
                if (@mail($to,$sub ject, $msg, $headers)) {
                echo "<b>$succes s</b><br/><a href=\"$returnu rl\">Go Back</a>";
                } else {
                echo "$failure <br/><a href=\"javascri pt:history.go(-1)\">Go Back</a>";
                }
                ?>
                [/php]
                FILE README.TXT
                Code:
                Name=Easy Form Mailer
                Version=1.5
                Date= November 14, 2006
                Developer=Md. Zakir Hossain (Raju)
                Email=rajuru(at)gmail(dot)com
                URL=http://www.rajuru.xenexbd.com
                License: LGPL
                I appreciate the email's last credit line but not mandatory. A thank is highly deserved 
                
                
                Overview:
                Using this script anyone can easily get form result to his/her mailbox. You can use this script for any form 2 mail purpose.
                You can define mandatory fields without a single line of code. Just put __ (double underscore) before field name
                You can show custom message on success or failure of submission
                
                
                How to Use:
                1. Create a new page and design form.
                2. You can use as many fields as you wish
                3. put __ (double underscore) before the name of any compolsory fields. suppose username field is mandatory. so its name should be __username
                4. Create at least three hidden fields as below
                
                Name						Value
                ------						----------------------------------------------
                Email_Recipient			your email address where you wish to receive email
                Email_Sender			your mail subject
                Email_Subject			send address, you can use an email box for visitors to give his email address		
                
                5. Optionally you can create 3 more hidden fields
                Name						Value
                ------					---------------------------------------------
                Email_Success				Message after mail sending success
                Email_Failure				Message if mail sending fails
                Return_Url					The address where user should be back after successful submission
                
                Note: These 6 fields are case-sensitive
                Ronald :cool:

                Comment

                • Gazza54321
                  New Member
                  • Jan 2008
                  • 1

                  #9
                  [QUOTE=Tracker30 00]Well, i've downloaded both those links you guys gave me, but now im lost :|

                  Hey Tracker3000, a bit late now, but did you get this Perl CGI Formmail problem resolved in the end?.

                  Gazza
                  Last edited by Gazza54321; Jan 18 '08, 02:42 PM. Reason: missed an S

                  Comment

                  Working...