SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using forms with mailto function

    Hi...

    I am currently trying to send data keyed into a form as email. So far I come across this script from MSDN's site:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>mailto Submission Sample</TITLE>
    <META NAME="AUTHOR" CONTENT="InetSDK">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
    <META NAME="MS.LOCALE" CONTENT="EN-US">
    <META NAME="ROBOTS" CONTENT="noindex">
    <STYLE>
    BODY {font-size: 8pt; font-family: Arial;}
    TD, LABEL, TEXTAREA, INPUT, BUTTON {font-size: 8pt; font-family: Arial;}
    </STYLE>
    <SCRIPT>
    function fnSetAction(){
    if(oMailForm.recipient.value!="" ){
    var sAction="mailto:" + oMailForm.recipient.value + "?";
    if(oMailForm.subject.value!="" ){
    sAction+="&Subject=" + oMailForm.subject.value;
    }
    if(oMailForm.cc.value!="" ){
    sAction+="&cc=" + oMailForm.cc.value;
    }
    if(oMailForm.bcc.value!="" ){
    sAction+="&bcc=" + oMailForm.bcc.value;
    }
    if(oMailForm.body.value!="" ){
    sAction+="&body=" + oMailForm.body.value; 
    }
    oMailForm.action=sAction;
    }
    else{
    alert("Address required." );
    }
    }
    </SCRIPT>
    <STYLE>
    SPAN {text-decoration: underline;}
    </STYLE>
    <!-- SAMPLE_STYLE_START -->
    <LINK REL="stylesheet" HREF="/workshop/basicSDKIE4.css" TYPE="text/css">
    <!-- SAMPLE_STYLE_END -->
    </HEAD>
    <!-- TOOLBAR_START -->
    <!-- TOOLBAR_EXEMPT -->
    <!-- TOOLBAR_END -->
    <BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF" LINK="#000000" VLINK="#808080" ALINK="#000000">
    <BLOCKQUOTE CLASS="body">
    <!-- CONTENTS_START -->
    <H2>mailto Submission Sample</H2>
    <P>This sample demonstrates the use of the <b>mailto</b> protocol to submit form data via e-mail.
    The e-mail information is provided by appending the data to the protocol in script, or using the related field names.</P>
    <P>
    <FORM METHOD="POST" ENCTYPE="text/plain" onsubmit="fnSetAction()" NAME=oMailForm>
    <TABLE>
    <TR>
    <TD><LABEL FOR=oTo><SPAN>A</SPAN>ddress:</label></TD>
    <TD><INPUT ACCESSKEY="A" ID="oTo" VALUE="" TYPE=text name="recipient"></TD></TR>
    <TR>
    <TD><LABEL FOR=oSubject><SPAN>S</SPAN>ubject:</label></TD>
    <TD><INPUT ACCESSKEY="S" VALUE="" ID="oSubject" TYPE=text name="subject"></TD></TR>
    <TR><TD><LABEL FOR=oCC><SPAN>C</SPAN>C:</label></TD>
    <TD><INPUT ACCESSKEY="C" ID="oCC" VALUE="" TYPE=text NAME="cc"></TD></TR>
    <TR><TD><LABEL FOR=oBCC><SPAN>B</SPAN>CC:</label></TD>
    <TD><INPUT ACCESSKEY="B" ID="oBCC" VALUE="" type=text NAME="bcc"></TD></TR>
    <TR><TD><LABEL FOR=oBody><SPAN>M</SPAN>essage Body:</label></TD>
    <TD><TEXTAREA TYPE=text ACCESSKEY="M" COLS=40 ROWS=5 ID="oBody" NAME="body"></TEXTAREA>
    </TD></TR>
    <TR><TD><BUTTON ACCESSKEY="E" TYPE=submit>Send <SPAN>E</SPAN>-mail</BUTTON></TD>
    <TD><BUTTON ACCESSKEY="R" TYPE=reset><SPAN>R</SPAN>eset E-mail Form</BUTTON></TD></TR>
    </TABLE>
    </FORM>
    <!-- CONTENTS_END -->
    <!-- START_PAGE_FOOTER -->
    <BR><BR><BR>
    &copy; <A CLASS="clsIncCpyRt" HREF="<A href="http://www.microsoft.com/isapi/gomscom.asp?TARGET=/info/cpyright.htm">http://www.microsoft.com/isapi/gomscom.asp?TARGET=/info/cpyright.htm" TARGET="_top"> 2002 Microsoft Corporation. All rights reserved. Terms of use</A>.
    <!-- END_PAGE_FOOTER -->
    </BLOCKQUOTE>
    </BODY>
    </HTML>
    or the code can be found here: http://msdn.microsoft.com/workshop/s...formmailto.htm

    I plan to make the form send the data to two different email addresses, remove CC and BCC... and replace Message with Address. I also plan to add in Email Address and Contact No. for users to fill in. How do I modify the code? I tried but still am clueless. Thanks.

  2. #2
    SitePoint Addict
    Join Date
    Mar 2002
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found the same script and did this:-

    http://members.aol.com/nickjc67/guestboo.htm

    Nick
    All4YourPC for all your PC needs. Custom software.
    Websites. Web marketing. Training.
    http://members.aol.com/nickjc67

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with form mail

    how can i make a simple e-mail form with 5 feilds

    in the is two iput fields i want to echo the current echo the current users Name: and Email: so they don't have to type it in agian

    then the other to fields just a few drop down menu's that the user will have to select

    then when submit to a comfirm page, and so i recieve all the info from there form most impotant there name and email that they did'nt have to type

    and tips or samples would be wicked


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •